]> git.ozlabs.org Git - patchwork/commitdiff
Update documentation and default settings to suit patchwork deployment model
authorJeremy Kerr <jk@ozlabs.org>
Sun, 24 May 2015 09:50:33 +0000 (17:50 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 28 May 2015 01:05:37 +0000 (09:05 +0800)
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: Jeremy Kerr <jk@ozlabs.org>
docs/INSTALL
lib/apache2/patchwork.wsgi
manage.py
patchwork/settings/prod.py [deleted file]
patchwork/settings/production.example.py [new file with mode: 0644]

index fdee59297401284bc21a2cf991b819e8585fe51f..7e1f309ddf5b306decb5318a5b9d51d5b7493a7f 100644 (file)
@@ -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
index 02d581d0e948c04b27748594ffcea69036aa91de..efa870bc5d3503ad64c69c17f50604ff6ce88274 100644 (file)
@@ -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()
index 04eac77e49fc0aa6d6d47ec4c1f571bb0f1d5100..fe6189ee29778e88fac72af5d897ac8ab7875359 100755 (executable)
--- a/manage.py
+++ b/manage.py
@@ -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
 
diff --git a/patchwork/settings/prod.py b/patchwork/settings/prod.py
deleted file mode 100644 (file)
index d71f3df..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-"""
-Sample production-ready settings for patchwork project.
-
-Most of these are commented out as they will be installation dependent.
-
-Design based on:
-    http://www.revsys.com/blog/2014/nov/21/recommended-django-project-layout/
-"""
-
-from base import *
-
-#
-# Core settings
-# https://docs.djangoproject.com/en/1.6/ref/settings/#core-settings
-#
-
-# Security
-
-# SECRET_KEY = '00000000000000000000000000000000000000000000000000'
-
-# Email
-
-# 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')
-
-
-#
-# Static files settings
-# https://docs.djangoproject.com/en/1.6/ref/settings/#static-files
-#
-
-# STATIC_ROOT = '/srv/patchwork/htdocs'
-
-
-#
-# Custom user overrides (for legacy)
-#
-
-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
diff --git a/patchwork/settings/production.example.py b/patchwork/settings/production.example.py
new file mode 100644 (file)
index 0000000..fd0a1f6
--- /dev/null
@@ -0,0 +1,58 @@
+"""
+Sample production-ready settings for patchwork project.
+
+Most of these are commented out as they will be installation dependent.
+
+Design based on:
+    http://www.revsys.com/blog/2014/nov/21/recommended-django-project-layout/
+"""
+
+from base import *
+
+#
+# Core settings
+# https://docs.djangoproject.com/en/1.6/ref/settings/#core-settings
+#
+
+# 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'),
+)
+
+DEFAULT_FROM_EMAIL = 'Patchwork <patchwork@patchwork.example.com>'
+NOTIFICATION_FROM_EMAIL = DEFAULT_FROM_EMAIL
+
+# Database
+#
+# 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',
+    },
+}
+
+#
+# Static files settings. Set this to the 
+# https://docs.djangoproject.com/en/1.7/ref/settings/#static-files
+#
+
+STATIC_ROOT = '/srv/patchwork/htdocs/static'
+