Moved a number of settings to local_settings.py

master
Andrew Stewart 2012-10-18 19:00:15 -07:00
parent 2b7d90bda5
commit b54454ffa5
2 changed files with 94 additions and 92 deletions

View File

@ -1,6 +1,15 @@
import os
from settings import INSTALLED_APPS
DEBUG = True
TEMPLATE_DEBUG = DEBUG
BASE_PATH = os.path.dirname(__file__)
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
ADMINS = (
('Name', 'name@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
@ -14,6 +23,17 @@ DATABASES = {
}
}
TIME_ZONE = 'America/New_York'
LANGUAGE_CODE = 'en-us'
MEDIA_ROOT = os.path.join(BASE_PATH, 'media/uploads')
MEDIA_URL = '/media/uploads/'
if DEBUG:
STATIC_URL = '/media/'
SECRET_KEY = ''
DEFAULT_FROM_EMAIL = 'support@snipt.net'
@ -21,6 +41,7 @@ SERVER_EMAIL = 'support@snipt.net'
EMAIL_BACKEND = 'postmark.django_backend.EmailBackend'
POSTMARK_API_KEY = ''
# Virtualenv
VIRTUALENV_PATH = ''
AMAZON_API_KEY = ''
@ -30,6 +51,27 @@ STRIPE_API_KEY = ''
ENV_HOST = 'user@domain.com:22'
# Bugsnag
BUGSNAG = {
"api_key": "",
"project_root": PROJECT_PATH,
}
# HTTPS
if not DEBUG:
USE_HTTPS = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SESSION_COOKIE_DOMAIN = '.snipt.net'
if not DEBUG:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'haystack',
},
}
# Extensions
INSTALLED_APPS += ('django_extensions',)

View File

@ -1,26 +1,19 @@
# Django settings for snipt project.
import os, socket
import os
if socket.gethostname() in ['air.local', 'pro.local']:
DEBUG = True
else:
DEBUG = False
TEMPLATE_DEBUG = DEBUG
BASE_PATH = os.path.dirname(__file__)
ADMINS = (
('Name', 'name@domain.com'),
)
MANAGERS = ADMINS
INTERNAL_IPS = ('127.0.0.1',)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '',
'NAME': 'snipt',
'USER': '',
'PASSWORD': '',
'HOST': 'localhost',
@ -28,18 +21,7 @@ DATABASES = {
}
}
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/New_York'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
INTERNAL_IPS = ('127.0.0.1',)
SITE_ID = 1
@ -51,6 +33,18 @@ USE_I18N = True
# calendars according to the current locale
USE_L10N = True
# Local time zone. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
#
# On Unix systems, a value of None will cause Django to use the same timezone as
# the operating system. On a Windows environment, this must be set to the same
# as your system time zone
TIME_ZONE = 'America/New_York'
# Language code for the Django installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join(BASE_PATH, 'media/uploads')
@ -65,10 +59,7 @@ MEDIA_URL = '/media/uploads/'
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.path.join(BASE_PATH, 'static')
if DEBUG:
STATIC_URL = '/media/'
else:
STATIC_URL = '/static/'
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
@ -82,9 +73,38 @@ STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = ''
INSTALLED_APPS = (
'gunicorn',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'debug_toolbar',
'django_bcrypt',
'haystack',
'markdown_deux',
'pagination',
'postmark',
'registration',
'south',
'taggit',
'tastypie',
'typogrify',
'accounts',
'blogs',
'snipts',
'utils',
)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
@ -119,36 +139,6 @@ TEMPLATE_DIRS = (
os.path.join(PROJECT_PATH, 'templates')
)
INSTALLED_APPS = (
'gunicorn',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'debug_toolbar',
'django_bcrypt',
'haystack',
'markdown_deux',
'pagination',
'postmark',
'registration',
'south',
'taggit',
'tastypie',
'typogrify',
'accounts',
'blogs',
'snipts',
'utils',
)
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
@ -172,14 +162,11 @@ LOGGING = {
}
}
# Email
DEFAULT_FROM_EMAIL = 'support@snipt.net'
SERVER_EMAIL = 'support@snipt.net'
EMAIL_BACKEND = 'postmark.django_backend.EmailBackend'
POSTMARK_API_KEY = ''
# Virtualenv
VIRTUALENV_PATH = ''
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
},
}
# Account settings
LOGIN_REDIRECT_URL = '/'
@ -187,13 +174,6 @@ LOGIN_URL = '/login/'
LOGOUT_URL = '/logout/'
ACCOUNT_ACTIVATION_DAYS = 0
# HTTPS
if not DEBUG:
USE_HTTPS = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SESSION_COOKIE_DOMAIN = '.snipt.net'
# Messages
MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage'
@ -205,29 +185,9 @@ ABSOLUTE_URL_OVERRIDES = {
# Accounts
AUTH_PROFILE_MODULE = 'accounts.UserProfile'
# Search
if not DEBUG:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'haystack',
},
}
else:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
},
}
# API
TASTYPIE_CANNED_ERROR = "There was an error with your request. The site developers have a record of this error, please email api@snipt.net and we'll help you out."
# Extensions
if DEBUG:
INSTALLED_APPS += ('django_extensions',)
try:
from local_settings import *
except ImportError: