[PATCH 1/2] settings: Regroup sections per upstream docs

Stephen Finucane stephen.finucane at intel.com
Thu Jul 14 08:25:24 AEST 2016


Signed-off-by: Stephen Finucane <stephen.finucane at intel.com>
---
 patchwork/settings/base.py               |   61 +++++++++++++++--------------
 patchwork/settings/dev.py                |   12 +-----
 patchwork/settings/production.example.py |    6 +-
 3 files changed, 36 insertions(+), 43 deletions(-)

diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py
index 735c67a..b78ed4b 100644
--- a/patchwork/settings/base.py
+++ b/patchwork/settings/base.py
@@ -11,11 +11,9 @@ ROOT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)),
 
 #
 # Core settings
-# https://docs.djangoproject.com/en/1.6/ref/settings/#core-settings
+# https://docs.djangoproject.com/en/1.8/ref/settings/#core-settings
 #
 
-# Models
-
 INSTALLED_APPS = [
     'django.contrib.auth',
     'django.contrib.contenttypes',
@@ -28,16 +26,6 @@ INSTALLED_APPS = [
     'patchwork',
 ]
 
-try:
-    # django rest framework isn't a standard package in most distros, so
-    # don't make it compulsory
-    import rest_framework  # NOQA
-    INSTALLED_APPS += ['rest_framework']
-except ImportError:
-    pass
-
-# HTTP
-
 MIDDLEWARE_CLASSES = [
     'django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
@@ -52,24 +40,16 @@ if django.VERSION >= (1, 7):
 else:
     MIDDLEWARE_CLASSES.append('django.middleware.doc.XViewMiddleware')
 
-# Globalization
-
 TIME_ZONE = 'Australia/Canberra'
 
 LANGUAGE_CODE = 'en-au'
 
 USE_I18N = True
 
-# Testing
-
 TEST_RUNNER = 'django.test.runner.DiscoverRunner'
 
-# URLs
-
 ROOT_URLCONF = 'patchwork.urls'
 
-# Templates
-
 _TEMPLATE_DIRS = [
     os.path.join(ROOT_DIR, 'templates'),
 ]
@@ -108,23 +88,23 @@ else:
     ]
 
 
-# Email
-
 DEFAULT_FROM_EMAIL = 'Patchwork <patchwork at patchwork.example.com>'
+
 SERVER_EMAIL = DEFAULT_FROM_EMAIL
 
 #
 # Auth settings
-# https://docs.djangoproject.com/en/1.6/ref/settings/#auth
+# https://docs.djangoproject.com/en/1.8/ref/settings/#auth
 #
 
 LOGIN_URL = 'auth_login'
+
 LOGIN_REDIRECT_URL = 'user-profile'
 
 
 #
 # Sites settings
-# https://docs.djangoproject.com/en/1.6/ref/settings/#sites
+# https://docs.djangoproject.com/en/1.8/ref/settings/#sites
 #
 
 SITE_ID = 1
@@ -132,7 +112,7 @@ SITE_ID = 1
 
 #
 # Static files settings
-# https://docs.djangoproject.com/en/1.6/ref/settings/#static-files
+# https://docs.djangoproject.com/en/1.8/ref/settings/#static-files
 #
 
 STATIC_URL = '/static/'
@@ -141,6 +121,30 @@ STATICFILES_DIRS = [
     os.path.join(ROOT_DIR, 'htdocs'),
 ]
 
+#
+# Third-party application settings
+#
+
+try:
+    # django rest framework isn't a standard package in most distros, so
+    # don't make it compulsory
+    import rest_framework  # NOQA
+
+    INSTALLED_APPS += [
+        'rest_framework'
+    ]
+except ImportError:
+    pass
+
+#
+# Third-party application settings
+#
+
+# rest_framework
+
+REST_FRAMEWORK = {
+    'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.NamespaceVersioning'
+}
 
 #
 # Patchwork settings
@@ -151,6 +155,7 @@ DEFAULT_ITEMS_PER_PAGE = 100
 CONFIRMATION_VALIDITY_DAYS = 7
 
 NOTIFICATION_DELAY_MINUTES = 10
+
 NOTIFICATION_FROM_EMAIL = DEFAULT_FROM_EMAIL
 
 # Set to True to enable the Patchwork XML-RPC interface
@@ -158,10 +163,8 @@ ENABLE_XMLRPC = False
 
 # Set to True to enable the Patchwork REST API
 ENABLE_REST_API = False
+
 REST_RESULTS_PER_PAGE = 30
-REST_FRAMEWORK = {
-    'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.NamespaceVersioning'
-}
 
 # Set to True to enable redirections or URLs from previous versions
 # of patchwork
diff --git a/patchwork/settings/dev.py b/patchwork/settings/dev.py
index e5c88d2..63e066b 100644
--- a/patchwork/settings/dev.py
+++ b/patchwork/settings/dev.py
@@ -15,26 +15,18 @@ from .base import *  # noqa
 
 #
 # Core settings
-# https://docs.djangoproject.com/en/1.6/ref/settings/#core-settings
+# https://docs.djangoproject.com/en/1.8/ref/settings/#core-settings
 #
 
-# Security
-
 SECRET_KEY = '00000000000000000000000000000000000000000000000000'
 
-# Debugging
-
 DEBUG = True
 
-# Templates
-
 if django.VERSION < (1, 8):
     # In Django 1.8+, this is only necessary if the value differs from
     # the value for 'DEBUG'
     TEMPLATE_DEBUG = True
 
-# Database
-
 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.mysql',
@@ -56,8 +48,6 @@ if django.VERSION >= (1, 7):
 else:
     DATABASES['default']['TEST_CHARSET'] = 'utf8'
 
-# Email
-
 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
 
 #
diff --git a/patchwork/settings/production.example.py b/patchwork/settings/production.example.py
index 408fddc..03a0fb0 100644
--- a/patchwork/settings/production.example.py
+++ b/patchwork/settings/production.example.py
@@ -17,7 +17,7 @@ from .base import *  # noqa
 
 #
 # Core settings
-# https://docs.djangoproject.com/en/1.6/ref/settings/#core-settings
+# https://docs.djangoproject.com/en/1.8/ref/settings/#core-settings
 #
 
 # Security
@@ -53,7 +53,7 @@ ADMINS = (
 #
 # 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
+# see https://docs.djangoproject.com/en/1.8/ref/settings/#databases
 
 DATABASES = {
     'default': {
@@ -68,7 +68,7 @@ DATABASES = {
 
 #
 # Static files settings
-# https://docs.djangoproject.com/en/1.7/ref/settings/#static-files
+# https://docs.djangoproject.com/en/1.8/ref/settings/#static-files
 # https://docs.djangoproject.com/en/1.8/ref/contrib/staticfiles/#manifeststaticfilesstorage
 #
 
-- 
1.7.4.1



More information about the Patchwork mailing list