Mercurial > public > bravenewsurf
changeset 26:6f68f6800843
For #5, make some tweaks to the files to prepare for production hosting.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 01 Nov 2011 19:17:07 -0500 |
parents | 72bfeac8f4f3 |
children | a5e8741452a3 |
files | bns_website/apache/bns.wsgi bns_website/settings/base.py bns_website/settings/production.py |
diffstat | 3 files changed, 67 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/bns_website/apache/bns.wsgi Tue Nov 01 18:22:34 2011 -0500 +++ b/bns_website/apache/bns.wsgi Tue Nov 01 19:17:07 2011 -0500 @@ -5,11 +5,11 @@ here = os.path.dirname(__file__) website = os.path.dirname(here) -project = os.path.dirname(website) -third_party_apps = os.path.join(project, '3rdparty') +repo = os.path.dirname(website) +project = os.path.dirname(repo) eggs = os.path.join(project, 'eggs') -sys.path.extend([project, website, third_party_apps]) +sys.path.extend([repo, website]) os.environ['PYTHON_EGG_CACHE'] = eggs
--- a/bns_website/settings/base.py Tue Nov 01 18:22:34 2011 -0500 +++ b/bns_website/settings/base.py Tue Nov 01 19:17:07 2011 -0500 @@ -9,22 +9,13 @@ TEMPLATE_DEBUG = DEBUG ADMINS = [ + ('Bob Mourlam', 'bob.mourlam@gmail.com'), ('Brian Neal', 'bgneal@gmail.com'), + ('Chris Ridgway', 'ckridgway@gmail.com'), ] MANAGERS = ADMINS -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': '', # Or path to database file if using sqlite3. - 'USER': '', # Not used with sqlite3. - 'PASSWORD': '', # Not used with sqlite3. - 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': '', # Set to empty string for default. Not used with sqlite3. - } -} - # 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. @@ -50,7 +41,7 @@ # Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/home/media/media.lawrence.com/media/" -MEDIA_ROOT = os.path.abspath(os.path.join(PROJECT_PATH, '..', 'media')) +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. @@ -61,7 +52,7 @@ # 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/" -STATIC_ROOT = os.path.abspath(os.path.join(PROJECT_PATH, '..', 'static')) +STATIC_ROOT = os.path.abspath(os.path.join(PROJECT_PATH, '..', '..', 'static')) # URL prefix for static files. # Example: "http://media.lawrence.com/static/"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bns_website/settings/production.py Tue Nov 01 19:17:07 2011 -0500 @@ -0,0 +1,60 @@ +# Django production settings for bns_website project. + +from settings.base import * + +DEBUG = False +TEMPLATE_DEBUG = DEBUG + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'bravenewsurf', + 'USER': SECRETS['DB_USER'], + 'PASSWORD': SECRETS['DB_PASSWORD'], + }, +} + +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', 'bns.log'), + 'mode': 'a', + 'maxBytes': 100 * 1024, + 'backupCount': 10, + }, + 'mail_admins': { + 'class': 'django.utils.log.AdminEmailHandler', + 'level': 'ERROR', + 'formatter': 'simple', + }, + }, + 'loggers': { + 'django':{ + 'level': 'ERROR', + 'propagate': False, + 'handlers': ['file'], + }, + }, + 'root': { + 'level': 'DEBUG', + 'handlers': ['file'], + }, +}