Created
March 20, 2016 00:55
-
-
Save kunanit/bf1e2c915b34b320b5c0 to your computer and use it in GitHub Desktop.
local settings file for a django project
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
''' | |
creates local settings for a django project | |
- define secret key | |
- use a local sqlite3 database | |
reference: http://stackoverflow.com/questions/4909958/django-local-settings | |
''' | |
import os | |
os.environ['SECRET_KEY'] = 'mysecretkey' | |
BASE_DIR = os.path.dirname(os.path.dirname(__file__)) | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.sqlite3', | |
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | |
} | |
} | |
## put the following at the end of the settings.py file: | |
''' | |
try: | |
from local_settings import * | |
except ImportError: | |
pass | |
SECRET_KEY = os.environ['SECRET_KEY'] | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment