I have an app, Scaffold, installed, that runs perfectly when I use python manage.py runserver
but when I try to start it using django-admin, it fails;
You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
I try calling it with django-admin migrate --settings=scaffold.settings
And I get; ImportError: No module named scaffold.settings
I've tried multiple things, googled around, but can't seem to figure out what I need to change. The settings.py file is in the directory ..\scaffold but I am no longer certain that is the one I need to use.
You should be using manage.py
unless have a specific reason for not wanting project-specific configuration. According to the docs
manage.py is automatically created in each Django project. manage.py is a thin wrapper around django-admin that takes care of several things for you before delegating to django-admin:
- It puts your project’s package on sys.path.
- It sets the DJANGO_SETTINGS_MODULE environment variable so that it points to your project’s settings.py file.
- It calls django.setup() to initialize various internals of Django.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With