Mercurial > public > sg101
changeset 499:1a09a7bea000
For #236, switch to a settings package scheme.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 30 Nov 2011 02:41:18 +0000 (2011-11-30) |
parents | b137a0966e4b |
children | 886cc99e8406 |
files | gpp/apache/sg101.wsgi gpp/settings.py gpp/settings/__init__.py gpp/settings/base.py gpp/settings/local.py gpp/settings/production.py gpp/settings/test.py gpp/test_settings.py |
diffstat | 7 files changed, 482 insertions(+), 348 deletions(-) [+] |
line wrap: on
line diff
--- a/gpp/apache/sg101.wsgi Thu Nov 24 21:27:07 2011 +0000 +++ b/gpp/apache/sg101.wsgi Wed Nov 30 02:41:18 2011 +0000 @@ -32,7 +32,7 @@ if not OFFLINE: - os.environ['DJANGO_SETTINGS_MODULE'] = 'gpp.settings' + os.environ['DJANGO_SETTINGS_MODULE'] = 'gpp.settings.production' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() else:
--- a/gpp/settings.py Thu Nov 24 21:27:07 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,330 +0,0 @@ -# Django settings for gpp project. - -import os -import platform -from decimal import Decimal - -from django.contrib.messages import constants as message_constants - -import local_settings - -project_path = os.path.abspath(os.path.split(__file__)[0]) - -DEBUG = local_settings.DEBUG -TEMPLATE_DEBUG = DEBUG - -ADMINS = ( - ('Brian Neal', 'admin@surfguitar101.com'), -) - -AUTH_PROFILE_MODULE = 'bio.userprofile' - -MANAGERS = ADMINS - -DATABASES = local_settings.DATABASES - -INTERNAL_IPS = local_settings.INTERNAL_IPS - -# 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. -# If running in a Windows environment this must be set to the same as your -# system time zone. -TIME_ZONE = local_settings.TIME_ZONE - -# Language code for this installation. All choices can be found here: -# http://www.i18nguy.com/unicode/language-identifiers.html -LANGUAGE_CODE = 'en-us' - -SITE_ID = local_settings.SITE_ID - -# If you set this to False, Django will make some optimizations so as not -# to load the internationalization machinery. -USE_I18N = False - -# Absolute path to the directory that holds media. -# Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = local_settings.MEDIA_ROOT - -# URL that handles the media served from MEDIA_ROOT. Make sure to use a -# trailing slash if there is a path component (optional in other cases). -# Examples: "http://media.lawrence.com", "http://example.com/media/" -MEDIA_URL = local_settings.MEDIA_URL - -# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a -# trailing slash. -# Examples: "http://foo.com/media/", "/media/". -ADMIN_MEDIA_PREFIX = local_settings.ADMIN_MEDIA_PREFIX - -# Staticfiles settings: -STATICFILES_DIRS = local_settings.STATICFILES_DIRS -STATIC_ROOT = local_settings.STATIC_ROOT -STATIC_URL = local_settings.STATIC_URL - -# Make this unique, and don't share it with anybody. -SECRET_KEY = local_settings.SECRET_KEY - -# List of Loader classes that know how to import templates from various sources. - -if DEBUG: - TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', - ) -else: - TEMPLATE_LOADERS = ( - ('django.template.loaders.cached.Loader', ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', - )), - ) - -if DEBUG: - MIDDLEWARE_CLASSES = ( - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'debug_toolbar.middleware.DebugToolbarMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'gpp.core.middleware.InactiveUserMiddleware', - 'gpp.core.middleware.WhosOnline', - 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', - ) -else: - MIDDLEWARE_CLASSES = ( - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'gpp.core.middleware.InactiveUserMiddleware', - 'gpp.core.middleware.WhosOnline', - 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', - ) - -ROOT_URLCONF = 'gpp.urls' - -TEMPLATE_DIRS = ( - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. - os.path.join(project_path, 'templates'), -) - -TEMPLATE_CONTEXT_PROCESSORS = ( - "django.contrib.auth.context_processors.auth", - "django.core.context_processors.debug", - "django.core.context_processors.request", - "django.core.context_processors.media", - "django.core.context_processors.static", - "django.contrib.messages.context_processors.messages", -) - -INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.admindocs', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.flatpages', - 'django.contrib.humanize', - 'django.contrib.markup', - 'django.contrib.messages', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.staticfiles', - 'elsewhere', - 'tagging', - 'haystack', - 'queued_search', - 'accounts', - 'antispam', - 'bio', - 'bulletins', - 'comments', - 'contact', - 'core', - 'donations', - 'downloads', - 'forums', - 'gcalendar', - 'irc', - 'legacy', - 'mailer', - 'membermap', - 'messages', - 'news', - 'oembed', - 'podcast', - 'polls', - 'potd', - 'shoutbox', - 'smiley', - 'weblinks', - 'ygroup', -] -if DEBUG: - INSTALLED_APPS.append('debug_toolbar') - -LOGIN_URL = '/accounts/login/' -LOGIN_REDIRECT_URL = '/profile/me/' -LOGOUT_URL = '/accounts/logout/' - -FILE_UPLOAD_PERMISSIONS = 0644 -DEFAULT_FROM_EMAIL = ADMINS[0][1] - -####################################################################### -# Messages -####################################################################### -MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage' -MESSAGE_TAGS = { - message_constants.DEBUG: 'notice', - message_constants.INFO: 'info', - message_constants.SUCCESS: 'success', - message_constants.WARNING: 'alert', - message_constants.ERROR: 'error', -} - -####################################################################### -# Email -####################################################################### -EMAIL_HOST = local_settings.EMAIL_HOST -EMAIL_PORT = local_settings.EMAIL_PORT - -####################################################################### -# Caching -####################################################################### -if local_settings.USE_CACHE: - CACHES = local_settings.CACHES - CACHE_MIDDLEWARE_ANONYMOUS_ONLY = local_settings.CACHE_MIDDLEWARE_ANONYMOUS_ONLY - CACHE_MIDDLEWARE_SECONDS = local_settings.CACHE_MIDDLEWARE_SECONDS - CACHE_MIDDLEWARE_KEY_PREFIX = local_settings.CACHE_MIDDLEWARE_KEY_PREFIX - -####################################################################### -# Sessions -####################################################################### -SESSION_ENGINE = "django.contrib.sessions.backends.cached_db" -SESSION_COOKIE_AGE = 2 * 7 * 24 * 60 * 60 # 2 weeks in seconds -SESSION_COOKIE_DOMAIN = None -SESSION_COOKIE_NAME = 'sg101_sessionid' -SESSION_COOKIE_PATH = '/' -SESSION_COOKIE_SECURE = False -SESSION_EXPIRE_AT_BROWSER_CLOSE = False -SESSION_SAVE_EVERY_REQUEST = False - -####################################################################### -# Tagging Specific Settings -####################################################################### -FORCE_LOWERCASE_TAGS = True -MAX_TAG_LENGTH = 50 - -####################################################################### -# Haystack Search Settings -####################################################################### -HAYSTACK_SITECONF = 'gpp.search_sites' -HAYSTACK_SEARCH_ENGINE = 'xapian' -HAYSTACK_XAPIAN_PATH = os.path.join(project_path, 'xapian_index') - - -####################################################################### -# GPP Specific Settings -####################################################################### -GPP_LOG_LEVEL = 0 -GPP_SEND_EMAIL = local_settings.GPP_SEND_EMAIL # see MAILER_ENQUEUE_MAIL -GPP_NO_REPLY_EMAIL = 'no_reply' -AVATAR_DIR = 'avatars' -MAX_AVATAR_SIZE_BYTES = 2 * 1024 * 1024 -MAX_AVATAR_SIZE_PIXELS = 100 -AVATAR_DEFAULT_URL = MEDIA_URL + AVATAR_DIR + '/default.png' - -# Donations application settings: -DONATIONS_DEBUG = local_settings.DONATIONS_DEBUG -DONATIONS_ITEM_NAME = 'Donation for SurfGuitar101.com' -DONATIONS_BUSINESS = 'brian@surfguitar101.com' -DONATIONS_BUSINESS_DEBUG = local_settings.DONATIONS_BUSINESS_DEBUG -DONATIONS_GOAL = Decimal('100.00') # monthly goal -DONATIONS_ANON_NAME = u'Anonymous' -DONATIONS_ITEM_NUM = '500' # donation w/name listed -DONATIONS_ITEM_ANON_NUM = '501' # donation listed as anonymous - -# If MAILER_ENQUEUE_MAIL is True, all emails will be stored in the -# mailer application's mail queue (database table). It is then expected -# that a daemon or cron job will actually send the mail out. If -# MAILER_ENQUEUE_MAIL is False, then email will only be sent if -# the setting GPP_SEND_EMAIL (above) is True. In any event, emails -# will be logged via the Python logger if the Python logger filter -# DEBUG is active. - -MAILER_ENQUEUE_MAIL = True - -# Oembed settings -OEMBED_MAXWIDTH = 480 -OEMBED_MAXHEIGHT = 295 - -# GCalendar settings -GCAL_CALENDAR_ID = 'i81lu3fkh57sgqqenogefd9v78@group.calendar.google.com' - -# Google OAuth settings -GOOGLE_OAUTH_CONSUMER_KEY = local_settings.GOOGLE_OAUTH_CONSUMER_KEY -GOOGLE_OAUTH_PRIVATE_KEY_PATH = local_settings.GOOGLE_OAUTH_PRIVATE_KEY_PATH - -####################################################################### -# Configure Logging -####################################################################### - -LOGGING = local_settings.LOGGING - -####################################################################### -# Django Debug Toolbar -####################################################################### - -if DEBUG: - DEBUG_TOOLBAR_CONFIG = local_settings.DEBUG_TOOLBAR_CONFIG - -####################################################################### -# Asynchronous settings (queues, queued_search, redis, celery, etc) -####################################################################### -QUEUE_BACKEND = 'redisd' -QUEUE_REDIS_CONNECTION = 'localhost:6379' -QUEUE_REDIS_DB = 0 - -####################################################################### -# Open Graph Protocol related settings -####################################################################### -OGP_DEFAULT_IMAGE = 'http://surfguitar101.com/media/podcast/podcast_logo.jpg' -OGP_FB_ID = '100001558124013' - -####################################################################### -# URL's of 3rd party Javascript and CSS files. -# These dictionaries are used by core/templatetags/script_tags, and -# should also be used by developers when creating form media classes. -GPP_THIRD_PARTY_JS = { - 'jquery': [ - 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js', - ], - 'jquery-jeditable': [ - 'js/jquery.jeditable.mini.js', - ], - 'jquery-ui': [ - 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js', - ], - 'markitup': [ - 'js/markitup/jquery.markitup.pack.js', - 'js/markitup/sets/markdown/set.js', - ], - 'tiny_mce': [ - 'js/tiny_mce/tiny_mce.js', - 'js/tiny_mce_init_std.js', - ], -} - -GPP_THIRD_PARTY_CSS = { - 'jquery-ui': [ - 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/redmond/jquery-ui.css', - ], - 'markitup': [ - 'js/markitup/skins/markitup/style.css', - 'js/markitup/sets/markdown/style.css', - ], -} -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/settings/base.py Wed Nov 30 02:41:18 2011 +0000 @@ -0,0 +1,284 @@ +# Base Django settings for the gpp project. + +import os +from decimal import Decimal + +import django.utils.simplejson as json +from django.contrib.messages import constants as message_constants + +PROJECT_PATH = os.path.abspath(os.path.join(os.path.split(__file__)[0], '..')) + +DEBUG = True +TEMPLATE_DEBUG = DEBUG + +ADMINS = ( + ('Brian Neal', 'admin@surfguitar101.com'), +) + +MANAGERS = ADMINS + +AUTH_PROFILE_MODULE = 'bio.userprofile' + +INTERNAL_IPS = ['127.0.0.1'] + +# 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. +# If running in a Windows environment this must be set to the same as your +# system time zone. +TIME_ZONE = 'America/Chicago' + +# Language code for this installation. All choices can be found here: +# http://www.i18nguy.com/unicode/language-identifiers.html +LANGUAGE_CODE = 'en-us' + +SITE_ID = 1 + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N = False + +# Absolute path to the directory that holds media. +# Example: "/home/media/media.lawrence.com/" +MEDIA_ROOT = os.path.abspath(os.path.join(PROJECT_PATH, '..', 'media')) + +# URL that handles the media served from MEDIA_ROOT. Make sure to use a +# trailing slash if there is a path component (optional in other cases). +# Examples: "http://media.lawrence.com", "http://example.com/media/" +MEDIA_URL = '/media/' + +# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a +# trailing slash. +# Examples: "http://foo.com/media/", "/media/". +ADMIN_MEDIA_PREFIX = '/static/admin/' + +# Staticfiles settings: +STATICFILES_DIRS = [ + os.path.abspath(os.path.join(PROJECT_PATH, '..', 'static')), +] +STATIC_ROOT = '/tmp/test_static_root' +STATIC_URL = '/static/' + +# Make this unique, and don't share it with anybody. +SECRETS = json.load(open(os.path.join(PROJECT_PATH, 'settings', 'secrets.json'))) +SECRET_KEY = SECRETS['SECRET_KEY'] + +# List of Loader classes that know how to import templates from various sources. + +TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', +) + +MIDDLEWARE_CLASSES = [ + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'gpp.core.middleware.InactiveUserMiddleware', + 'gpp.core.middleware.WhosOnline', + 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', +] + +ROOT_URLCONF = 'gpp.urls' + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. + os.path.join(PROJECT_PATH, 'templates'), +) + +TEMPLATE_CONTEXT_PROCESSORS = ( + "django.contrib.auth.context_processors.auth", + "django.core.context_processors.debug", + "django.core.context_processors.request", + "django.core.context_processors.media", + "django.core.context_processors.static", + "django.contrib.messages.context_processors.messages", +) + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.admindocs', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.flatpages', + 'django.contrib.humanize', + 'django.contrib.markup', + 'django.contrib.messages', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.staticfiles', + 'elsewhere', + 'tagging', + 'haystack', + 'queued_search', + 'accounts', + 'antispam', + 'bio', + 'bulletins', + 'comments', + 'contact', + 'core', + 'donations', + 'downloads', + 'forums', + 'gcalendar', + 'irc', + 'legacy', + 'mailer', + 'membermap', + 'messages', + 'news', + 'oembed', + 'podcast', + 'polls', + 'potd', + 'shoutbox', + 'smiley', + 'weblinks', + 'ygroup', +] + +LOGIN_URL = '/accounts/login/' +LOGIN_REDIRECT_URL = '/profile/me/' +LOGOUT_URL = '/accounts/logout/' + +FILE_UPLOAD_PERMISSIONS = 0644 +DEFAULT_FROM_EMAIL = ADMINS[0][1] + +####################################################################### +# Messages +####################################################################### +MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage' +MESSAGE_TAGS = { + message_constants.DEBUG: 'notice', + message_constants.INFO: 'info', + message_constants.SUCCESS: 'success', + message_constants.WARNING: 'alert', + message_constants.ERROR: 'error', +} + +####################################################################### +# Email +####################################################################### +EMAIL_HOST = 'localhost' +EMAIL_PORT = 1025 + +####################################################################### +# Sessions +####################################################################### +SESSION_ENGINE = "django.contrib.sessions.backends.cached_db" +SESSION_COOKIE_AGE = 2 * 7 * 24 * 60 * 60 # 2 weeks in seconds +SESSION_COOKIE_DOMAIN = None +SESSION_COOKIE_NAME = 'sg101_sessionid' +SESSION_COOKIE_PATH = '/' +SESSION_COOKIE_SECURE = False +SESSION_EXPIRE_AT_BROWSER_CLOSE = False +SESSION_SAVE_EVERY_REQUEST = False + +####################################################################### +# Tagging Specific Settings +####################################################################### +FORCE_LOWERCASE_TAGS = True +MAX_TAG_LENGTH = 50 + +####################################################################### +# Haystack Search Settings +####################################################################### +HAYSTACK_SITECONF = 'gpp.search_sites' +HAYSTACK_SEARCH_ENGINE = 'xapian' +HAYSTACK_XAPIAN_PATH = os.path.join(PROJECT_PATH, 'xapian_index') + + +####################################################################### +# GPP Specific Settings +####################################################################### +GPP_LOG_LEVEL = 0 +GPP_SEND_EMAIL = False +GPP_NO_REPLY_EMAIL = 'no_reply' +AVATAR_DIR = 'avatars' +MAX_AVATAR_SIZE_BYTES = 2 * 1024 * 1024 +MAX_AVATAR_SIZE_PIXELS = 100 +AVATAR_DEFAULT_URL = MEDIA_URL + AVATAR_DIR + '/default.png' + +# Donations application settings: +DONATIONS_DEBUG = False +DONATIONS_ITEM_NAME = 'Donation for SurfGuitar101.com' +DONATIONS_BUSINESS = 'brian@surfguitar101.com' +DONATIONS_BUSINESS_DEBUG = 'bgneal_1246137628_biz@gmail.com' +DONATIONS_GOAL = Decimal('100.00') # monthly goal +DONATIONS_ANON_NAME = u'Anonymous' +DONATIONS_ITEM_NUM = '500' # donation w/name listed +DONATIONS_ITEM_ANON_NUM = '501' # donation listed as anonymous + +# If MAILER_ENQUEUE_MAIL is True, all emails will be stored in the +# mailer application's mail queue (database table). It is then expected +# that a daemon or cron job will actually send the mail out. If +# MAILER_ENQUEUE_MAIL is False, then email will only be sent if +# the setting GPP_SEND_EMAIL (above) is True. In any event, emails +# will be logged via the Python logger if the Python logger filter +# DEBUG is active. + +MAILER_ENQUEUE_MAIL = True + +# Oembed settings +OEMBED_MAXWIDTH = 480 +OEMBED_MAXHEIGHT = 295 + +# GCalendar settings +GCAL_CALENDAR_ID = 'i81lu3fkh57sgqqenogefd9v78@group.calendar.google.com' + +# Google OAuth settings +GOOGLE_OAUTH_CONSUMER_KEY = 'surfguitar101.com' +GOOGLE_OAUTH_PRIVATE_KEY_PATH = '/home/brian/google/myrsakey.pem' + +####################################################################### +# Asynchronous settings (queues, queued_search, redis, celery, etc) +####################################################################### +QUEUE_BACKEND = 'redisd' +QUEUE_REDIS_CONNECTION = 'localhost:6379' +QUEUE_REDIS_DB = 0 + +####################################################################### +# Open Graph Protocol related settings +####################################################################### +OGP_DEFAULT_IMAGE = 'http://surfguitar101.com/media/podcast/podcast_logo.jpg' +OGP_FB_ID = '100001558124013' + +####################################################################### +# URL's of 3rd party Javascript and CSS files. +# These dictionaries are used by core/templatetags/script_tags, and +# should also be used by developers when creating form media classes. +GPP_THIRD_PARTY_JS = { + 'jquery': [ + 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js', + ], + 'jquery-jeditable': [ + 'js/jquery.jeditable.mini.js', + ], + 'jquery-ui': [ + 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js', + ], + 'markitup': [ + 'js/markitup/jquery.markitup.pack.js', + 'js/markitup/sets/markdown/set.js', + ], + 'tiny_mce': [ + 'js/tiny_mce/tiny_mce.js', + 'js/tiny_mce_init_std.js', + ], +} + +GPP_THIRD_PARTY_CSS = { + 'jquery-ui': [ + 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/redmond/jquery-ui.css', + ], + 'markitup': [ + 'js/markitup/skins/markitup/style.css', + 'js/markitup/sets/markdown/style.css', + ], +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/settings/local.py Wed Nov 30 02:41:18 2011 +0000 @@ -0,0 +1,82 @@ +""" +Local Django settings. + +""" +from settings.base import * + +DEBUG = True + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'gremmies_portal', + 'USER': SECRETS['DB_USER'], + 'PASSWORD': SECRETS['DB_PASSWORD'], + }, +} + +# Django Debug Toolbar support +if DEBUG: + try: + import debug_toolbar + except ImportError: + pass + else: + i = MIDDLEWARE_CLASSES.index('django.middleware.common.CommonMiddleware') + MIDDLEWARE_CLASSES.insert(i + 1, + 'debug_toolbar.middleware.DebugToolbarMiddleware') + INSTALLED_APPS.append('debug_toolbar') + DEBUG_TOOLBAR_CONFIG = { + 'INTERCEPT_REDIRECTS': True, + } + +# Path to elsewhere application static images +STATICFILES_DIRS.append(('elsewhere', + '/home/brian/coding/python/django/3rdparty/elsewhere/img')) + +# Logging configuration + +LOGGING = { + 'version': 1, + 'disable_existing_loggers': True, + 'formatters': { + 'verbose': { + 'format': '%(asctime)s %(levelname)s %(module)s %(process)d %(thread)d %(message)s' + }, + 'simple': { + 'format': '%(asctime)s %(levelname)s %(message)s' + }, + }, + 'handlers': { + 'console': { + 'class': 'logging.StreamHandler', + 'level': 'DEBUG', + 'formatter': 'simple', + }, + 'file': { + 'class': 'logging.handlers.RotatingFileHandler', + 'level': 'DEBUG', + 'formatter': 'simple', + 'filename': os.path.join(PROJECT_PATH, 'logs', 'sg101.log'), + 'mode': 'a', + 'maxBytes': 100 * 1024, + 'backupCount': 10, + }, + 'mail_admins': { + 'class': 'django.utils.log.AdminEmailHandler', + 'level': 'ERROR', + 'formatter': 'simple', + }, + }, + 'loggers': { + 'django':{ + 'level': 'WARNING', + 'propagate': False, + 'handlers': ['file'], + }, + }, + 'root': { + 'level': 'DEBUG', + 'handlers': ['file'], + }, +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/settings/production.py Wed Nov 30 02:41:18 2011 +0000 @@ -0,0 +1,99 @@ +""" +Production Django settings. + +""" +from settings.base import * + +DEBUG = False + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'gremmies_portal', + 'USER': SECRETS['DB_USER'], + 'PASSWORD': SECRETS['DB_PASSWORD'], + }, +} + +# Path to elsewhere application static images +STATICFILES_DIRS.append(('elsewhere', + '/home/var/django-sites/sg101/3rdparty/elsewhere/img')) + +STATIC_ROOT = os.path.abspath(os.path.join(PROJECT_PATH, '..', 'static_serve')) + +# Used cached template loader +TEMPLATE_LOADERS = [ + ('django.template.loaders.cached.Loader', ( + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', + )), +] + +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', + 'LOCATION': '127.0.0.1:11211', + 'TIMEOUT': 600, + }, +} +CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True +CACHE_MIDDLEWARE_SECONDS = 600 +CACHE_MIDDLEWARE_KEY_PREFIX = '' + +EMAIL_HOST = 'localhost' +EMAIL_PORT = 25 + +GPP_SEND_EMAIL = True +DONATIONS_DEBUG = False + +# Logging configuration + +LOGGING = { + 'version': 1, + 'disable_existing_loggers': True, + 'formatters': { + 'verbose': { + 'format': '%(asctime)s %(levelname)s %(module)s %(process)d %(thread)d %(message)s' + }, + 'simple': { + 'format': '%(asctime)s %(levelname)s %(message)s' + }, + }, + 'handlers': { + 'console': { + 'class': 'logging.StreamHandler', + 'level': 'DEBUG', + 'formatter': 'simple', + }, + 'file': { + 'class': 'logging.handlers.RotatingFileHandler', + 'level': 'DEBUG', + 'formatter': 'simple', + 'filename': os.path.join(PROJECT_PATH, 'logs', 'sg101.log'), + 'mode': 'a', + 'maxBytes': 100 * 1024, + 'backupCount': 10, + }, + 'mail_admins': { + 'class': 'django.utils.log.AdminEmailHandler', + 'level': 'ERROR', + 'formatter': 'simple', + }, + }, + 'loggers': { + 'django':{ + 'level': 'WARNING', + 'propagate': False, + 'handlers': ['file'], + }, + 'django.request':{ + 'level': 'ERROR', + 'propagate': True, + 'handlers': ['mail_admins'], + }, + }, + 'root': { + 'level': 'INFO', + 'handlers': ['file'], + }, +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/settings/test.py Wed Nov 30 02:41:18 2011 +0000 @@ -0,0 +1,16 @@ +""" +Settings to use when running tests. Uses sqlite for speed. + +""" +from settings.base import * + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': 'dev.db', + }, +} + +# For unit-testing the Donations module w/o using the Paypal sandbox +DONATIONS_DEBUG_VERIFY_RESPONSE = 'VERIFIED' +DONATIONS_BUSINESS_DEBUG = 'brian@surfguitar101.com'
--- a/gpp/test_settings.py Thu Nov 24 21:27:07 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -""" -Settings to use when running tests. Uses sqlite for speed. -This idea was taken from -http://blog.davidziegler.net/post/370368042/test-database-settings-in-django -""" -from settings import * - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': 'dev.db', - }, -} - -# For unit-testing the Donations module w/o using the Paypal sandbox -DONATIONS_DEBUG_VERIFY_RESPONSE = 'VERIFIED' -DONATIONS_BUSINESS_DEBUG = 'brian@surfguitar101.com'