from django.core.management.base import BaseCommand
def Command(BaseCommand):
def handle(self, *args, **options):
self.stdout.write( "lol" )
So I tried creating a custom command in Django 1.8. It is in the directory appname/management/commands/commandname.py . However, trying to run the command using:
python manage.py commandname
yielded this error:
TypeError: Command() takes exactly 1 argument (0 given)
I've ensured that all the directories contain an __ init__.py file and that the app is added to the project. There doesn't seem to by much info on this online. Please do help.
Based on this doc page (https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/), you may want to change that line from
def Command(BaseCommand):
toclass Command(BaseCommand):
. (it looks like some further changes will be necessary as well)