Skip to content

Commit

Permalink
Use execfile to load local_settings, so it can refer to local variables
Browse files Browse the repository at this point in the history
  • Loading branch information
slinkp committed Sep 5, 2012
1 parent 6d7e584 commit 902c860
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/project/settings.py
Expand Up @@ -174,7 +174,8 @@
# ------------------------
# Override settings values by importing the local_settings.py module.

try:
from .local_settings import *
except ImportError:
pass
LOCAL_SETTINGS_FILE = os.path.join(os.path.dirname(__file__), 'local_settings.py')
if os.path.exists(LOCAL_SETTINGS_FILE):
# By doing this instead of import, local_settings.py can refer to
# local variables from settings.py without circular imports.
execfile(LOCAL_SETTINGS_FILE)

0 comments on commit 902c860

Please sign in to comment.