qmsk_www split settings with production support
authorTero Marttila <terom@paivola.fi>
Sun, 14 Sep 2014 04:16:52 +0300
changeset 214 1048b9081edc
parent 213 121cf2e6330f
child 215 d72e797a8977
qmsk_www split settings with production support
qmsk_www/settings.py
qmsk_www/settings/__init__.py
qmsk_www/settings/database.py
qmsk_www/settings/development.py
qmsk_www/settings/localization.py
qmsk_www/settings/pages.py
qmsk_www/settings/site.py
--- a/qmsk_www/settings.py	Sun Sep 14 03:54:19 2014 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-"""
-Django settings for qmsk_www project.
-
-For more information on this file, see
-https://docs.djangoproject.com/en/1.7/topics/settings/
-
-For the full list of settings and their values, see
-https://docs.djangoproject.com/en/1.7/ref/settings/
-"""
-
-# Quick-start development settings - unsuitable for production
-# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
-
-# SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = '&e#@fir!k-*w(=0$@j&0guyv8qq*mh7_55j6w@2=hm0x9^ya-2'
-
-# SECURITY WARNING: don't run with debug turned on in production!
-DEBUG = True
-
-TEMPLATE_DEBUG = True
-
-ALLOWED_HOSTS = []
-
-
-## Application definition
-INSTALLED_APPS = (
-    'django.contrib.staticfiles',
-)
-
-MIDDLEWARE_CLASSES = (
-
-)
-
-ROOT_URLCONF = 'qmsk_www.urls'
-
-WSGI_APPLICATION = 'qmsk_www.wsgi.application'
-
-
-## Database
-# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
-
-DATABASES = {
-
-}
-
-## Internationalization
-# https://docs.djangoproject.com/en/1.7/topics/i18n/
-
-LANGUAGE_CODE = 'en-us'
-
-TIME_ZONE = 'UTC'
-
-USE_I18N = True
-
-USE_L10N = True
-
-USE_TZ = True
-
-## Static files (CSS, JavaScript, Images)
-# https://docs.djangoproject.com/en/1.7/howto/static-files/
-STATIC_URL = '/static/'
-STATICFILES_DIRS = (
-    './qmsk_www/static',
-)
-
-## Site templates
-TEMPLATE_DIRS = (
-    './qmsk_www/templates',
-)
-
-## Logging
-LOGGING = {
-    'version': 1,
-    'disable_existing_loggers': False,
-    'formatters': {
-        'qmsk': {
-            'format': '[%(levelname)5s] %(module)20s:%(funcName)-20s : %(message)s',
-        },
-    },
-    'handlers': {
-        'console': {
-            'level':        'DEBUG',
-            'class':        'logging.StreamHandler',
-            'formatter':    'qmsk',
-        },
-    },
-    'loggers': {
-        'qmsk_www_pages': {
-            'handlers': [ 'console' ],
-            'level': 'INFO',
-        }
-    },
-}
-
-## Custom
-INSTALLED_APPS += (
-    'qmsk_www_pages',
-)
-
-QMSK_WWW_PAGES_DIR = './pages'
-QMSK_WWW_PAGES_SITE = "qmsk.net"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmsk_www/settings/__init__.py	Sun Sep 14 04:16:52 2014 +0300
@@ -0,0 +1,19 @@
+"""
+    Django settings for qmsk_www project.
+
+    For more information on this file, see
+    https://docs.djangoproject.com/en/1.7/topics/settings/
+
+    For the full list of settings and their values, see
+    https://docs.djangoproject.com/en/1.7/ref/settings/
+"""
+
+from qmsk_www.settings.database import *
+from qmsk_www.settings.localization import *
+from qmsk_www.settings.pages import *
+from qmsk_www.settings.site import *
+
+try:
+    from qmsk_www.settings.production import *
+except ImportError:
+    from qmsk_www.settings.development import *
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmsk_www/settings/database.py	Sun Sep 14 04:16:52 2014 +0300
@@ -0,0 +1,6 @@
+## Database
+# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
+DATABASES = {
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmsk_www/settings/development.py	Sun Sep 14 04:16:52 2014 +0300
@@ -0,0 +1,37 @@
+# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = '&e#@fir!k-*w(=0$@j&0guyv8qq*mh7_55j6w@2=hm0x9^ya-2'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+TEMPLATE_DEBUG = True
+
+ALLOWED_HOSTS = []
+
+## Logging
+LOGGING = {
+    'version': 1,
+    'disable_existing_loggers': False,
+    'formatters': {
+        'qmsk': {
+            'format': '[%(levelname)5s] %(module)20s:%(funcName)-20s : %(message)s',
+        },
+    },
+    'handlers': {
+        'console': {
+            'level':        'DEBUG',
+            'class':        'logging.StreamHandler',
+            'formatter':    'qmsk',
+        },
+    },
+    'loggers': {
+        'qmsk_www_pages': {
+            'handlers': [ 'console' ],
+            'level': 'INFO',
+        }
+    },
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmsk_www/settings/localization.py	Sun Sep 14 04:16:52 2014 +0300
@@ -0,0 +1,13 @@
+## Internationalization
+# https://docs.djangoproject.com/en/1.7/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmsk_www/settings/pages.py	Sun Sep 14 04:16:52 2014 +0300
@@ -0,0 +1,2 @@
+QMSK_WWW_PAGES_DIR = './pages'
+QMSK_WWW_PAGES_SITE = "qmsk.net"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmsk_www/settings/site.py	Sun Sep 14 04:16:52 2014 +0300
@@ -0,0 +1,27 @@
+## Application definition
+INSTALLED_APPS = (
+    'django.contrib.staticfiles',
+    
+    'qmsk_www_pages',
+)
+
+MIDDLEWARE_CLASSES = (
+
+)
+
+ROOT_URLCONF = 'qmsk_www.urls'
+
+WSGI_APPLICATION = 'qmsk_www.wsgi.application'
+
+## Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.7/howto/static-files/
+STATIC_URL = '/static/'
+STATICFILES_DIRS = (
+    './qmsk_www/static',
+)
+
+## Site templates
+TEMPLATE_DIRS = (
+    './qmsk_www/templates',
+)
+