Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Moved a number of settings from settings into local_settings. #3

Merged
merged 1 commit into from Jan 14, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 42 additions & 0 deletions local_settings-template.py
@@ -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 = {
Expand All @@ -14,13 +23,25 @@
}
}

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'
SERVER_EMAIL = 'support@snipt.net'
EMAIL_BACKEND = 'postmark.django_backend.EmailBackend'
POSTMARK_API_KEY = ''

# Virtualenv
VIRTUALENV_PATH = ''

AMAZON_API_KEY = ''
Expand All @@ -30,6 +51,27 @@

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',)
144 changes: 52 additions & 92 deletions settings.py
@@ -1,45 +1,27 @@
# 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',
'PORT': '',
}
}

# 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

Expand All @@ -51,6 +33,18 @@
# 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')
Expand All @@ -65,10 +59,7 @@
# 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 = (
Expand All @@ -82,9 +73,38 @@
'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',
Expand Down Expand Up @@ -119,36 +139,6 @@
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.
Expand All @@ -172,28 +162,18 @@
}
}

# 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 = '/'
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'

Expand All @@ -205,29 +185,9 @@
# 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:
Expand Down