How to FIX "django.core.exceptions.ImproperlyConfigured:" Terminal ERROR
If you’ve used Python before, you may be wondering why we’re running
python manage.py shell
instead of justpython
. Both commands will start the interactive interpreter, but themanage.py shell
command has one key difference: before starting the interpreter, it tells Django which settings file to use.
Use Case: Many parts of Django, including the template system, rely on your settings, and you won’t be able to use them unless the framework knows which settings to use.
If you’re curious, here’s how it works behind the scenes. Django looks for an environment variable called
DJANGO_SETTINGS_MODULE
, which should be set to the import path of your settings.py. For example,DJANGO_SETTINGS_MODULE
might be set to'mysite.settings'
, assuming mysite is on your Python path.When you run
python manage.py shell
, the command takes care of settingDJANGO_SETTINGS_MODULE
for you.**
NB: Make sure you are in your python virtual environment on terminal
If you need assistance with your projects feel free to email me at info@airgad.com or whatsapp Jesse stay safe!