Created
September 26, 2011 01:09
-
-
Save airtonix/1241403 to your computer and use it in GitHub Desktop.
This file contains 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
import os | |
import sys | |
import ConfigParser | |
gettext = lambda s: s | |
DEBUG=True | |
HEREPATH=os.path.realpath( os.path.dirname(__file__) ) | |
PROJECT_ROOT = os.path.realpath( | |
os.path.dirname(HEREPATH) | |
) | |
SERVER_ROOT = os.path.realpath( | |
os.path.dirname(PROJECT_ROOT) | |
) | |
PROJECT_CONFIG = ConfigParser.ConfigParser() | |
PROJECT_CONFIG.read([os.path.join(SERVER_ROOT, 'website.cfg'), ]) | |
PROJECT_NAME = PROJECT_CONFIG.get('Django', 'project') | |
PROJECT_DOMAIN = PROJECT_CONFIG.get('Website', 'domain_name') | |
# | |
# Modularised Settings | |
# | |
for settings_file in os.listdir( HEREPATH ) : | |
file_name, file_ext = os.path.splitext(settings_file) | |
if file_ext == ".py" and file_name != "__init__" : | |
try: | |
logger.debug("Importing settings.{0}".format(file_name)) | |
exec("from {0} import *".format(file_name)) in globals() | |
except ImportError: | |
logger.error("Problem importing settings.{0}".format(file_name) ) | |
pass | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment