Skip to content

Instantly share code, notes, and snippets.

@chrislawlor
Last active September 28, 2015 12:48
Show Gist options
  • Save chrislawlor/1441339 to your computer and use it in GitHub Desktop.
Save chrislawlor/1441339 to your computer and use it in GitHub Desktop.
Starter for django dev local settings file
import sys
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'dev.sqlite',
'USER': '',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '',
'OPTIONS': {}
}
}
DEBUG = DEBUG_TEMPLATE = True
INTERNAL_IPS = ('127.0.0.1',)
# Don't show DDT in the admin, or in selenium tests
import re
def show_toolbar(request):
if 'test' in sys.argv:
return False
uri = request.get_full_path()
if re.match(r'/admin/', uri):
return False
return True
DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK': show_toolbar,
#'INTERCEPT_REDIRECTS': False
}
# Run unit tests in memory
if 'test' in sys.argv:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'spling_test.sqlite'
}
}
# Don't run migrations for unit tests
SOUTH_TESTS_MIGRATE = False
# Show emails in the console
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# or, use GMail
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'PASSWORD'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment