← Back to team overview

team4alfanous team mailing list archive

[Branch ~team4alfanous/alfanous/alfanous-git] Rev 498: Merge branch 'master' of github.com:01walid/alfanous

 

Merge authors:
  01walid (01walid)
------------------------------------------------------------
revno: 498 [merge]
committer: Assem Chelli <assem.ch@xxxxxxxxx>
timestamp: Sun 2013-01-06 01:18:12 +0100
message:
  Merge branch 'master' of github.com:01walid/alfanous
added:
  src/alfanous-django/settings.ini.proto
modified:
  src/alfanous-django/settings.py


--
lp:alfanous
https://code.launchpad.net/~team4alfanous/alfanous/alfanous-git

Your team Alfanous team is subscribed to branch lp:alfanous.
To unsubscribe from this branch go to https://code.launchpad.net/~team4alfanous/alfanous/alfanous-git/+edit-subscription
=== added file 'src/alfanous-django/settings.ini.proto'
--- src/alfanous-django/settings.ini.proto	1970-01-01 00:00:00 +0000
+++ src/alfanous-django/settings.ini.proto	2013-01-06 01:03:40 +0000
@@ -0,0 +1,37 @@
+[database]
+DATABASE_USER:
+DATABASE_PASSWORD:
+DATABASE_HOST:
+DATABASE_PORT:
+DATABASE_ENGINE: django.db.backends.sqlite3
+DATABASE_NAME: wui.db
+TESTSUITE_DATABASE_NAME: test_blo
+
+[secrets]
+SECRET_KEY: random-string-of-ascii
+CSRF_MIDDLEWARE_SECRET: random-string-of-ascii
+
+[cookies]
+SESSION_COOKIE_DOMAIN:
+
+# all settings in debug section should be false in productive environment
+# INTERNAL_IPS should be empty in productive environment
+[debug]
+DEBUG: true
+TEMPLATE_DEBUG: true
+VIEW_TEST: true
+INTERNAL_IPS: 127.0.0.1
+SKIP_CSRF_MIDDLEWARE: true
+
+[email]
+SERVER_EMAIL: django@localhost
+EMAIL_HOST: localhost
+
+# the [error mail] and [404 mail] sections are special. Just add lines with
+#  full name: email_address@xxxxxxxxx
+# each section must be present but may be empty.
+[error mail]
+Adam Smith: adam@localhost
+
+[404 mail]
+John Wayne: john@localhost
\ No newline at end of file

=== modified file 'src/alfanous-django/settings.py'
--- src/alfanous-django/settings.py	2012-10-26 21:26:34 +0000
+++ src/alfanous-django/settings.py	2013-01-06 01:03:40 +0000
@@ -1,5 +1,27 @@
 # Django settings for alfanousDjango project.
 
+from ConfigParser import RawConfigParser
+
+config = RawConfigParser()
+
+# set you setting path here.
+# the file have to be a system-config like, ini-style file, see settings.ini.proto for a prototype
+configFile = "settings.ini.proto" # e,g. '/etc/whatever/settings.ini'
+
+if configFile == "" or configFile == "settings.ini.proto":
+    print "WARNING: You need to specify a reliable path to the config file, see settings.py"
+
+config.read(configFile)
+
+# fetching critical info from the cofig file
+DATABASE_USER = config.get('database', 'DATABASE_USER')
+DATABASE_PASSWORD = config.get('database', 'DATABASE_PASSWORD')
+DATABASE_HOST = config.get('database', 'DATABASE_HOST')
+DATABASE_PORT = config.get('database', 'DATABASE_PORT')
+DATABASE_ENGINE = config.get('database', 'DATABASE_ENGINE')
+DATABASE_NAME = config.get('database', 'DATABASE_NAME')
+# TEST_DATABASE_NAME = config.get('database', 'TESTSUITE_DATABASE_NAME')
+
 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
 
@@ -11,12 +33,12 @@
 
 DATABASES = {
     'default': {
-        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-        'NAME': 'wui.db',                      # Or path to database file if using sqlite3.
-        'USER': '',                      # Not used with sqlite3.
-        'PASSWORD': '',                  # Not used with sqlite3.
-        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
-        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
+        'ENGINE': DATABASE_ENGINE, # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+        'NAME': DATABASE_NAME,                      # Or path to database file if using sqlite3.
+        'USER': DATABASE_USER,                      # Not used with sqlite3.
+        'PASSWORD': DATABASE_PASSWORD,                  # Not used with sqlite3.
+        'HOST': DATABASE_HOST,                      # Set to empty string for localhost. Not used with sqlite3.
+        'PORT': DATABASE_PORT,                      # Set to empty string for default. Not used with sqlite3.
     }
 }