Back

Explore Courses Blog Tutorials Interview Questions

Explore Tech Questions and Answers

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

0 votes
2 views
by (25.1k points)

I am trying to set up multiple setting files (development, production, ..) that include some base settings. Cannot succeed though. When I try to run ./manage.py runserver I am getting the following error:

(cb)clime@den /srv/www/cb $ ./manage.py runserver

ImproperlyConfigured: The SECRET_KEY setting must not be empty.

Here is my settings module:

(cb)clime@den /srv/www/cb/cb/settings $ ll

total 24

-rw-rw-r--. 1 clime clime 8230 Oct  2 02:56 base.py

-rw-rw-r--. 1 clime clime  489 Oct  2 03:09 development.py

-rw-rw-r--. 1 clime clime   24 Oct  2 02:34 __init__.py

-rw-rw-r--. 1 clime clime  471 Oct  2 02:51 production.py

If I add from base import * into /srv/www/cb/cb/settings/__init__.py (which is otherwise empty), it magically starts to work but I don't understand why. Anyone could explain to me what's going on here? It must be some python module magic.

1 Answer

0 votes
by (19.9k points)

I had the same error and it turned out to be a circular dependency between a module or class loaded by the settings and the settings module itself. In my case it was a middleware class which was named in the settings which itself tried to load the settings.

Related questions

Browse Categories

...