django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured
You can insert os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
before the django.setup()
line.
Call to django.setup()
should go after setting DJANGO_SETTINGS_MODULE
environment variable. Just move it into your __main__
right after os.environ.setdefault()
.
If you are getting a similar error after initiating your interaction with Django by running python
in a terminal, running python manage.py shell
in the appropriate directory may solve your issue.