Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Merged
merged 1 commit into from

2 participants

@stewart

No description provided.

@nicksergeant nicksergeant merged commit cf0832d into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 27, 2012
  1. @stewart
This page is out of date. Refresh to see the latest.
Showing with 94 additions and 92 deletions.
  1. +42 −0 local_settings-template.py
  2. +52 −92 settings.py
View
42 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 = {
@@ -14,6 +23,17 @@
}
}
+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 @@
EMAIL_BACKEND = 'postmark.django_backend.EmailBackend'
POSTMARK_API_KEY = ''
+# Virtualenv
VIRTUALENV_PATH = ''
AMAZON_API_KEY = ''
@@ -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',)
View
144 settings.py
@@ -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 @@
}
}
-# 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 @@
# 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 @@
# 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 @@
'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 @@
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 @@
}
}
-# 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 @@
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 @@
# 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:
Something went wrong with that request. Please try again.