2012-09-18 13:45:00 -07:00
# Django settings for snipt project.
2011-06-01 21:50:18 -07:00
2011-10-23 20:07:59 -07:00
import os , socket
2011-10-23 17:54:44 -07:00
2012-09-02 09:58:07 -07:00
if socket . gethostname ( ) in [ ' air.local ' , ' pro.local ' ] :
2011-12-22 19:23:50 -08:00
DEBUG = True
2011-10-23 20:07:59 -07:00
else :
2011-12-04 17:23:44 -08:00
DEBUG = False
2012-09-18 13:45:00 -07:00
2011-10-23 17:54:44 -07:00
TEMPLATE_DEBUG = DEBUG
2011-10-23 19:44:37 -07:00
BASE_PATH = os . path . dirname ( __file__ )
2011-06-01 21:50:18 -07:00
ADMINS = (
2012-09-18 13:45:00 -07:00
( ' Name ' , ' name@domain.com ' ) ,
2011-06-01 21:50:18 -07:00
)
2011-12-04 17:45:34 -08:00
MANAGERS = ADMINS
2011-06-01 21:50:18 -07:00
INTERNAL_IPS = ( ' 127.0.0.1 ' , )
2011-10-23 17:54:44 -07:00
DATABASES = {
' default ' : {
2012-02-14 18:09:39 -08:00
' ENGINE ' : ' django.db.backends.postgresql_psycopg2 ' ,
2012-09-18 13:45:00 -07:00
' NAME ' : ' ' ,
' USER ' : ' ' ,
' PASSWORD ' : ' ' ,
2012-02-14 18:09:39 -08:00
' HOST ' : ' localhost ' ,
2011-10-23 17:54:44 -07:00
' 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.
2011-06-01 21:50:18 -07:00
TIME_ZONE = ' America/New_York '
2011-10-23 17:54:44 -07:00
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
2011-06-01 21:50:18 -07:00
LANGUAGE_CODE = ' en-us '
2011-10-23 17:54:44 -07:00
2011-06-01 21:50:18 -07:00
SITE_ID = 1
2011-10-23 17:54:44 -07:00
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
2011-06-01 21:50:18 -07:00
2011-10-23 17:54:44 -07:00
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
2011-12-25 13:00:41 -08:00
MEDIA_ROOT = os . path . join ( BASE_PATH , ' media/uploads ' )
2011-10-23 17:54:44 -07:00
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
2011-12-25 13:00:41 -08:00
MEDIA_URL = ' /media/uploads/ '
2011-10-23 17:54:44 -07:00
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
2011-10-23 19:44:37 -07:00
STATIC_ROOT = os . path . join ( BASE_PATH , ' static ' )
2012-06-05 12:46:37 -07:00
if DEBUG :
STATIC_URL = ' /media/ '
else :
STATIC_URL = ' /static/ '
2011-10-23 17:54:44 -07:00
# Additional locations of static files
STATICFILES_DIRS = (
2011-10-23 19:44:37 -07:00
os . path . join ( BASE_PATH , ' media ' ) ,
2011-10-23 17:54:44 -07:00
)
2011-06-01 21:50:18 -07:00
2011-10-23 17:54:44 -07:00
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
' django.contrib.staticfiles.finders.FileSystemFinder ' ,
' django.contrib.staticfiles.finders.AppDirectoriesFinder ' ,
2011-06-01 21:50:18 -07:00
)
2011-10-23 17:54:44 -07:00
# Make this unique, and don't share it with anybody.
2012-09-18 13:45:00 -07:00
SECRET_KEY = ' '
2011-10-23 17:54:44 -07:00
# List of callables that know how to import templates from various sources.
2011-06-01 21:50:18 -07:00
TEMPLATE_LOADERS = (
2011-10-23 17:54:44 -07:00
' django.template.loaders.filesystem.Loader ' ,
' django.template.loaders.app_directories.Loader ' ,
# 'django.template.loaders.eggs.Loader',
2011-06-01 21:50:18 -07:00
)
2011-10-23 19:44:37 -07:00
TEMPLATE_CONTEXT_PROCESSORS = (
2012-06-04 13:22:00 -07:00
' django.contrib.auth.context_processors.auth ' ,
2011-10-23 19:44:37 -07:00
' django.core.context_processors.debug ' ,
' django.core.context_processors.i18n ' ,
' django.core.context_processors.media ' ,
' django.core.context_processors.request ' ,
' django.core.context_processors.static ' ,
)
2011-10-23 17:54:44 -07:00
2011-06-01 21:50:18 -07:00
MIDDLEWARE_CLASSES = (
2012-06-04 13:22:00 -07:00
' django.middleware.csrf.CsrfViewMiddleware ' ,
2011-06-01 21:50:18 -07:00
' django.middleware.common.CommonMiddleware ' ,
2011-10-23 17:54:44 -07:00
' django.contrib.sessions.middleware.SessionMiddleware ' ,
2011-06-01 21:50:18 -07:00
' django.contrib.auth.middleware.AuthenticationMiddleware ' ,
2011-10-23 17:54:44 -07:00
' django.contrib.messages.middleware.MessageMiddleware ' ,
2011-10-12 08:29:21 -07:00
' pagination.middleware.PaginationMiddleware ' ,
2012-06-04 14:09:08 -07:00
' blogs.middleware.BlogMiddleware ' ,
2011-06-01 21:50:18 -07:00
)
2011-10-23 17:54:44 -07:00
ROOT_URLCONF = ' snipt.urls '
PROJECT_PATH = os . path . abspath ( os . path . dirname ( __file__ ) )
2011-06-01 21:50:18 -07:00
2011-10-23 17:54:44 -07:00
TEMPLATE_DIRS = (
os . path . join ( PROJECT_PATH , ' templates ' )
)
2011-06-01 21:50:18 -07:00
INSTALLED_APPS = (
2011-10-23 17:54:44 -07:00
' gunicorn ' ,
2012-02-12 17:17:17 -08:00
2011-06-01 21:50:18 -07:00
' django.contrib.auth ' ,
' django.contrib.contenttypes ' ,
' django.contrib.humanize ' ,
' django.contrib.sessions ' ,
' django.contrib.sites ' ,
2011-10-23 17:54:44 -07:00
' django.contrib.messages ' ,
' django.contrib.staticfiles ' ,
' django.contrib.admin ' ,
2011-06-01 21:50:18 -07:00
2012-10-17 17:52:12 -07:00
' debug_toolbar ' ,
2011-06-01 21:50:18 -07:00
' django_bcrypt ' ,
2012-04-16 21:42:01 -07:00
' haystack ' ,
2012-04-23 11:34:21 -07:00
' markdown_deux ' ,
2011-10-12 08:29:21 -07:00
' pagination ' ,
2011-12-04 17:01:29 -08:00
' postmark ' ,
2012-02-12 17:17:17 -08:00
' registration ' ,
2011-10-23 17:54:44 -07:00
' south ' ,
2011-06-05 09:51:56 -07:00
' taggit ' ,
2011-10-01 10:23:05 -07:00
' tastypie ' ,
2012-09-01 10:55:57 -07:00
' typogrify ' ,
2012-02-12 17:17:17 -08:00
2012-06-26 08:33:22 -07:00
' accounts ' ,
2012-05-24 20:55:30 -07:00
' blogs ' ,
2011-06-02 19:39:14 -07:00
' snipts ' ,
2012-02-15 15:25:13 -08:00
' utils ' ,
2011-06-01 21:50:18 -07:00
)
2011-10-23 17:54:44 -07:00
# 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.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
' version ' : 1 ,
' disable_existing_loggers ' : False ,
' handlers ' : {
' mail_admins ' : {
' level ' : ' ERROR ' ,
' class ' : ' django.utils.log.AdminEmailHandler '
}
} ,
' loggers ' : {
2012-10-21 10:03:22 -07:00
' django.request ' : {
' handlers ' : [ ' mail_admins ' ] ,
' level ' : ' ERROR ' ,
' propagate ' : True ,
} ,
2011-10-23 17:54:44 -07:00
}
}
2011-06-01 21:50:18 -07:00
2011-10-23 18:12:45 -07:00
# Email
2012-08-01 11:21:54 -07:00
DEFAULT_FROM_EMAIL = ' support@snipt.net '
SERVER_EMAIL = ' support@snipt.net '
2011-12-04 17:31:33 -08:00
EMAIL_BACKEND = ' postmark.django_backend.EmailBackend '
2012-09-18 13:45:00 -07:00
POSTMARK_API_KEY = ' '
2011-10-23 18:12:45 -07:00
2011-10-23 17:54:44 -07:00
# Virtualenv
2012-09-18 13:45:00 -07:00
VIRTUALENV_PATH = ' '
2011-10-23 17:54:44 -07:00
# Account settings
LOGIN_REDIRECT_URL = ' / '
LOGIN_URL = ' /login/ '
LOGOUT_URL = ' /logout/ '
2012-02-12 21:42:25 -08:00
ACCOUNT_ACTIVATION_DAYS = 0
2011-10-23 17:54:44 -07:00
2012-04-23 19:02:43 -07:00
# HTTPS
if not DEBUG :
2012-06-12 07:13:58 -07:00
USE_HTTPS = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
2012-05-24 20:55:30 -07:00
SESSION_COOKIE_DOMAIN = ' .snipt.net '
2012-04-23 19:02:43 -07:00
2012-05-15 17:10:50 -07:00
# Messages
MESSAGE_STORAGE = ' django.contrib.messages.storage.cookie.CookieStorage '
2011-10-02 15:38:20 -07:00
# User absolute URLs
ABSOLUTE_URL_OVERRIDES = {
' auth.user ' : lambda u : " / %s / " % u . username ,
}
2011-10-24 20:34:07 -07:00
2012-06-26 08:33:22 -07:00
# Accounts
AUTH_PROFILE_MODULE = ' accounts.UserProfile '
2012-04-16 21:42:01 -07:00
# Search
2012-08-15 08:04:15 -07:00
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 ' ,
} ,
}
2012-04-16 21:42:01 -07:00
2012-09-14 06:47:16 -07:00
# 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. "
2011-12-04 09:00:51 -08:00
# Extensions
if DEBUG :
INSTALLED_APPS + = ( ' django_extensions ' , )
2012-09-18 13:45:00 -07:00
try :
from local_settings import *
except ImportError :
pass