Created
June 13, 2012 16:39
-
-
Save gnrfan/2925183 to your computer and use it in GitHub Desktop.
App-level configuration in Django
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## app1/constants.py | |
| MY_VAR = 100 | |
| ## app1/settings.py | |
| from django.conf import settings | |
| from app1 import constants | |
| MY_VAR = getattr(settings, 'MY_VAR', constants.MY_VAR) | |
| ## app1/views.py | |
| from django.conf import settings | |
| from app1 import settings as app1_settings | |
| print app1_settings.MY_VAR | |
| ## project/settings/__init__.py | |
| # MY_VAR = 200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment