Last active
August 29, 2015 14:12
-
-
Save claytantor/c38632f2f820cf034deb to your computer and use it in GitHub Desktop.
How to create environment based settings configs
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
[secrets] | |
DJANGO_SECRET_KEY: ill%92_5+gaw!7p5la0h+-=-pb2)l&%11(d@a8+#mff5z$r3^ |
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 | |
from ConfigParser import RawConfigParser | |
BASE_DIR = os.path.dirname(os.path.dirname(__file__)) | |
PROJECT_DIR = os.path.dirname(__file__) | |
CONF_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) | |
STATIC_MAIN_DIR = os.path.join(PROJECT_DIR, '..', 'static/') | |
here = lambda x: os.path.join(os.path.abspath(os.path.dirname(__file__)), x) | |
# you will need to copy the example and make custom | |
# settings for the environment | |
config = RawConfigParser() | |
#place in a dir that is not managed in the code base | |
# print 'config dir: {0}/conf/gitpatron_settings.ini'.format(CONF_DIR) | |
config.read('{0}/conf/settings.ini'.format(CONF_DIR)) | |
# Quick-start development settings - unsuitable for production | |
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ | |
# SECURITY WARNING: keep the secret key used in production secret! | |
SECRET_KEY = config.get('secrets','DJANGO_SECRET_KEY') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment