Commit d636cb34 authored by Jeremy Kerr's avatar Jeremy Kerr

Update documentation and default settings to suit patchwork deployment model

We've always allowed configuration without altering any of the
version-controlled files. With the recent settings changes, we have an
extra level of indirection with the dev/prod settings modules.

Since we have to edit a config file anyway, this change moves the
prod.py settings file to a template, which is then used directly by
mange.py (and the wsgi application).
Signed-off-by: 's avatarJeremy Kerr <jk@ozlabs.org>
parent cb407f1d
......@@ -108,11 +108,17 @@ in brackets):
cd ../python
ln -s ../packages/django/django ./django
The settings.py file contains default settings for patchwork, you'll
need to configure settings for your own setup.
The patchwork/settings/*.py files contain default settings for patchwork,
you'll need to configure settings for your own setup.
Rather than edit settings.py, create a file 'local_settings.py', and
override or add settings as necessary. You'll need to define the
Rather than editing these files (which will cause conflicts when you
update the base patchwork code), create a file 'production.py', based on
the example:
cp patchwork/settings/production.example.py \
patchwork/settings/production.py
and override or add settings as necessary. You'll need to define the
following:
SECRET_KEY
......
......@@ -13,7 +13,7 @@ basedir = os.path.join(
os.path.dirname(__file__), os.path.pardir, os.path.pardir)
sys.path.append(basedir)
os.environ['DJANGO_SETTINGS_MODULE'] = 'patchwork.settings.prod'
os.environ['DJANGO_SETTINGS_MODULE'] = 'patchwork.settings.production'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
......@@ -3,7 +3,8 @@ import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "patchwork.settings.prod")
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"patchwork.settings.production")
from django.core.management import execute_from_command_line
......
......@@ -15,48 +15,44 @@ from base import *
#
# Security
#
# You'll need to replace this to a random string. The following python code can
# be used to generate a secret key:
#
# import string, random
# chars = string.letters + string.digits + string.punctuation
# print repr("".join([random.choice(chars) for i in range(0,50)]))
# SECRET_KEY = '00000000000000000000000000000000000000000000000000'
# Email
#
# Replace this with your own details
# ADMINS = (
# ('Jeremy Kerr', 'jk@ozlabs.org'),
# )
# Database
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
# 'NAME': 'patchwork',
# },
# }
# File Uploads
# MEDIA_ROOT = os.path.join(
# ROOT_DIR, 'lib', 'python', 'django', 'contrib', 'admin', 'media')
ADMINS = (
# ('Jeremy Kerr', 'jk@ozlabs.org'),
)
DEFAULT_FROM_EMAIL = 'Patchwork <patchwork@patchwork.example.com>'
NOTIFICATION_FROM_EMAIL = DEFAULT_FROM_EMAIL
# Database
#
# Static files settings
# https://docs.djangoproject.com/en/1.6/ref/settings/#static-files
#
# STATIC_ROOT = '/srv/patchwork/htdocs'
# If you're using a postgres database, connecting over a local unix-domain
# socket, then the following setting should work for you. Otherwise,
# see https://docs.djangoproject.com/en/1.7/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'patchwork',
},
}
#
# Custom user overrides (for legacy)
# Static files settings. Set this to the
# https://docs.djangoproject.com/en/1.7/ref/settings/#static-files
#
try:
from local_settings import *
except ImportError, ex:
import sys
sys.stderr.write(\
("settings.py: error importing local settings file:\n" + \
"\t%s\n" + \
"Do you have a local_settings.py module?\n") % str(ex))
raise
STATIC_ROOT = '/srv/patchwork/htdocs/static'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment