I am working on Django project that uses several dozen configuration variables specified in several "settings" files located in project's root directory:
--> myproject
------> app folders
------> ...
--- settings.py
--- settings_global.py
--- settings_production.py
--- settings_development.py
Variables from different settings_* files are then get imported in settings.py file based on certain run-time parameters (host name etc). It all works rather well, but sometimes it's still hard to locate certain variable, so I'd like re-organize settings variables and split them into several categories:
- project-specific variables
- django-specific variables
- installed-app specific variables (such as settings for django_compressor, etc)
- environment-specific variables (production/development)
Also I'd like to move all settings files but settings.py file to settings subdirectory:
--> myproject
------> app folders
------> ...
------> settings
---------- __init__.py
---------- common.py
---------- production.py
---------- development.py
---------- apps.py
---------- ...
--- settings.py
I've created settings subdirectory (as well as empty __init__.py
file) and copied/renamed the settings files. Then I tried to import those variables in my setting.py file as following:
from settings.common import *
from settings.apps import *
However, I am getting the following error (even though ROOT_URLCONF exists in settings/common.py file):
AttributeError: 'Settings' object has no attribute 'ROOT_URLCONF'
What am I doing wrong?