[damned-lies/proxymodel: 1/2] New settings arrangement



commit ccc3809857575b2ca425c99178316080cca5f46d
Author: Stéphane Raimbault <stephane raimbault gmail com>
Date:   Fri Apr 23 03:03:09 2010 +0200

    New settings arrangement
    
    - split custom and common settings
    - ease updating when common settings are modified

 .gitignore                                    |    1 -
 README                                        |    4 +-
 settings.py                                   |   10 +++++++
 settings/10-custom.conf.sample                |   32 ++++++++++++++++++++++
 settings_sample.py => settings/20-common.conf |   36 ++----------------------
 5 files changed, 47 insertions(+), 36 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 907f594..ab81abc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,3 @@
 debug_toolbar
 django_openid
 locale
-settings.py
diff --git a/README b/README
index 5657e48..702410c 100644
--- a/README
+++ b/README
@@ -43,8 +43,8 @@ Requirements
 Installation
 ============
 
-1 - Rename settings_sample.py to settings.py and review settings
-    (please refer to Database configuration below for more
+1 - Rename settings/10-custom.conf.sample to settings/10-custom.conf.py and
+    review settings (please refer to Database configuration below for more
     informations).
     SCRATCHDIR should point to an existing directory, writable by
     the web application user.
diff --git a/settings.py b/settings.py
new file mode 100644
index 0000000..b5acbfc
--- /dev/null
+++ b/settings.py
@@ -0,0 +1,10 @@
+import os.path
+import glob
+
+conffiles = glob.glob(os.path.join(os.path.dirname(__file__), 'settings',
+    '[0-9]*.conf'))
+
+conffiles.sort()
+
+for f in conffiles:
+    execfile(os.path.abspath(f))
diff --git a/settings/10-custom.conf.sample b/settings/10-custom.conf.sample
new file mode 100644
index 0000000..1fe7703
--- /dev/null
+++ b/settings/10-custom.conf.sample
@@ -0,0 +1,32 @@
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+STATIC_SERVE = True
+USE_DEBUG_TOOLBAR = False
+USE_DJANGO_EXTENSIONS = False
+
+DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+DATABASE_NAME = os.path.join(PROJECT_PATH,'database.db')            # Or path to database file if using sqlite3.
+DATABASE_USER = ''             # Not used with sqlite3.
+DATABASE_PASSWORD = ''         # Not used with sqlite3.
+DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
+DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
+
+# If you can't use PostgreSQL :-/, here is the MySQL configuration:
+#
+# DATABASE_HOST = '/var/run/mysqld/mysqld.sock'
+#
+# DATABASE_OPTIONS = {
+#    'read_default_file': '/etc/mysql/my.cnf',
+#    'init_command': 'SET storage_engine=INNODB'
+# }
+#
+# Please refer to the README file to create an UTF-8 database with MySQL.
+
+EMAIL_HOST = 'localhost'
+EMAIL_HOST_USER = ''
+EMAIL_HOST_PASSWORD = ''
+EMAIL_SUBJECT_PREFIX = '[Damned Lies]'
+DEFAULT_FROM_EMAIL = 'gnomeweb gnome org'
+SERVER_EMAIL = 'gnomeweb gnome org'
+# When in STRINGFREEZE, where to send notifications (gnome-i18n gnome org) on any POT changes
+NOTIFICATIONS_TO = ['gnome-i18n gnome org']
diff --git a/settings_sample.py b/settings/20-common.conf
similarity index 73%
rename from settings_sample.py
rename to settings/20-common.conf
index 5e59fd3..50bceff 100644
--- a/settings_sample.py
+++ b/settings/20-common.conf
@@ -3,11 +3,6 @@
 import os
 gettext_noop = lambda s: s
 
-DEBUG = True
-TEMPLATE_DEBUG = DEBUG
-STATIC_SERVE = True
-USE_DEBUG_TOOLBAR = False
-
 PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
 
 ADMINS = (
@@ -17,33 +12,6 @@ ADMINS = (
 
 MANAGERS = ADMINS
 
-DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-DATABASE_NAME = os.path.join(PROJECT_PATH,'database.db')            # Or path to database file if using sqlite3.
-DATABASE_USER = ''             # Not used with sqlite3.
-DATABASE_PASSWORD = ''         # Not used with sqlite3.
-DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
-DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
-
-# If you can't use PostgreSQL :-/, here is the MySQL configuration:
-#
-# DATABASE_HOST = '/var/run/mysqld/mysqld.sock'
-#
-# DATABASE_OPTIONS = {
-#    'read_default_file': '/etc/mysql/my.cnf',
-#    'init_command': 'SET storage_engine=INNODB'
-# }
-#
-# Please refer to the README file to create an UTF-8 database with MySQL.
-
-EMAIL_HOST = 'localhost'
-EMAIL_HOST_USER = ''
-EMAIL_HOST_PASSWORD = ''
-EMAIL_SUBJECT_PREFIX = '[Damned Lies]'
-DEFAULT_FROM_EMAIL = 'gnomeweb gnome org'
-SERVER_EMAIL = 'gnomeweb gnome org'
-# When in STRINGFREEZE, where to send notifications (gnome-i18n gnome org) on any POT changes
-NOTIFICATIONS_TO = ['gnome-i18n gnome org']
-
 # 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.
@@ -83,7 +51,6 @@ UPLOAD_DIR = 'upload'
 UPLOAD_ARCHIVED_DIR = 'upload-archived'
 FILE_UPLOAD_PERMISSIONS = 0600
 
-
 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
 # trailing slash.
 # Examples: "http://foo.com/media/";, "/media/".
@@ -140,3 +107,6 @@ INTERNAL_IPS=('127.0.0.1',)
 if USE_DEBUG_TOOLBAR:
     MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
     INSTALLED_APPS += ('debug_toolbar',)
+
+if USE_DJANGO_EXTENSIONS:
+    INSTALLED_APPS += ('django_extensions',)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]