Django: Can't run custom commands

后端 未结 2 1709
温柔的废话
温柔的废话 2021-02-20 13:48

I\'ve written a simple custom command, hello.py:

from django.core.management.base import NoArgsCommand

class Command(NoArgsCommand):
    help = \"prints hello w         


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-20 14:26

    The problem was that I had another project on my PYTHONPATH. D'oh! I think it was picking up the settings.py from there first so didn't see my app. What pointed me in this direction was I tried running python manage.py create_jobs myapp (from django command extensions) and it returned an error indicating the app couldn't be found. Also @knutin mentioned INSTALLED_APPS.

提交回复
热议问题