For first step you need create application, "manage.py startapp myapp". 'management' folder should be located in your application folder. And don't forget add application in INSTALLED_APPS in your settings.py (INSTALLED_APPS = ('myapp', ))
On Thu, Apr 11, 2013 at 4:52 AM, Mark Lybrand <mlybr...@gmail.com> wrote: > I am at a loss how to get custom commands working in my Django project. > > I am on Windows 7, running Python 2.7.3, Django 1.4.5. When I try to make > my "hello world" command, I get an unknown command error. > > I have the following structure: > > │ manage.py > │ > ├───mysite > │ │ settings.py > │ │ settings.pyc > │ │ urls.py > │ │ urls.pyc > │ │ wsgi.py > │ │ wsgi.pyc > │ │ __init__.py > │ │ __init__.pyc > │ │ > │ └───management > │ │ __init__.py > │ │ > │ └───commands > │ x.py > │ __init__.py > > > And this is the code of my command: > > from optparse import make_option > from django.core.management.base import BaseCommand, CommandError > > class Command(BaseCommand): > option_list = BaseCommand.option_list + ( > make_option('--long', '-l', dest='long', > help='Help for the long options'), > ) > help = 'Help text goes here' > > def handle(self, **options): > print "This is a command" > > When I run > > python manage.py x > > I get: > > Unknown command: 'x' > Type 'manage.py help' for usage. > > Where should begin looking to troubleshoot this issue? > > Thanks in advance... > > Mark :) > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- Best regards, Andrey Kostakov Email/Gtalk: b...@dzen.ws -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.