[open-ils-commits] r845 - servres/trunk/conifer (gfawcett)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Mar 24 23:45:06 EDT 2010


Author: gfawcett
Date: 2010-03-24 23:45:03 -0400 (Wed, 24 Mar 2010)
New Revision: 845

Added:
   servres/trunk/conifer/local_settings.py.example
Modified:
   servres/trunk/conifer/settings.py
Log:
Establish a formal, required local_settings file. Warn deployer if none exists.

I've moved all of our testing-specific stuff from settings into local_settings.

Added: servres/trunk/conifer/local_settings.py.example
===================================================================
--- servres/trunk/conifer/local_settings.py.example	                        (rev 0)
+++ servres/trunk/conifer/local_settings.py.example	2010-03-25 03:45:03 UTC (rev 845)
@@ -0,0 +1,43 @@
+# -*- mode: python -*-
+
+import os
+from here import HERE
+
+#----------------------------------------------------------------------
+# You may need to set the PYTHON_EGG_CACHE directory, depending on how
+# you installed Syrup.
+
+# os.environ['PYTHON_EGG_CACHE'] = '/tmp/eggs'
+
+#----------------------------------------------------------------------
+
+DATABASE_ENGINE   = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+DATABASE_NAME     = '' # 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.
+
+#----------------------------------------------------------------------
+DEBUG = False
+
+ADMINS = (
+    # ('Your Name', 'your_email at domain.com'),
+)
+
+TIME_ZONE = 'America/Detroit'
+
+SECRET_KEY = 'replace-with-your-own-super-random-key- at vv(tuvt2+yu2r-$dxs$s7=iqjz_s!&'
+
+#----------------------------------------------------------------------
+
+EVERGREEN_AUTHENTICATION = False
+
+#----------------------------------------------------------------------
+# Stuff that probably belongs in a config table in the database, with
+# a nice UI to maintain it all.
+
+EVERGREEN_GATEWAY_SERVER = 'www.concat.ca'
+Z3950_CONFIG             = ('zed.concat.ca', 210, 'OWA')  #OWA,OSUL,CONIFER
+SIP_HOST                 = ('localhost', 8080)
+SIP_CREDENTIALS          = ('sipclient', 'c0n1fi3', 'graham home workstation')

Modified: servres/trunk/conifer/settings.py
===================================================================
--- servres/trunk/conifer/settings.py	2010-03-25 03:44:54 UTC (rev 844)
+++ servres/trunk/conifer/settings.py	2010-03-25 03:45:03 UTC (rev 845)
@@ -1,23 +1,21 @@
 # Django settings for conifer project.
 
-import os
+# Don't edit this file; edit local_settings.py instead.
 
-os.environ['PYTHON_EGG_CACHE'] = '/tmp/eggs'
+import sys
+from here import HERE
+sys.path.append(HERE('..'))
 
-BASE_DIRECTORY = os.path.abspath(os.path.dirname(__file__))
-HERE = lambda s: os.path.join(BASE_DIRECTORY, s)
+DEBUG = False
 
-DEBUG = True
-TEMPLATE_DEBUG = DEBUG
-
 ADMINS = (
     # ('Your Name', 'your_email at domain.com'),
 )
 
 MANAGERS = ADMINS
 
-DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-DATABASE_NAME = HERE('syrup.sqlite') # Or path to database file if using sqlite3.
+DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+DATABASE_NAME = ''   # 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.
@@ -61,13 +59,12 @@
 ADMIN_MEDIA_PREFIX = '/syrup/djmedia/'
 
 # Make this unique, and don't share it with anybody.
-SECRET_KEY = 'j$dnxqbi3iih+(@il3m at vv(tuvt2+yu2r-$dxs$s7=iqjz_s!&'
+SECRET_KEY = 'replace this yourself --- j$dnxqbi3iih+(@il3m at vv(tuvt2+yu2r-$dxs$s7=iqjz_s!&'
 
 # List of callables that know how to import templates from various sources.
 TEMPLATE_LOADERS = (
     'django.template.loaders.filesystem.load_template_source',
     'django.template.loaders.app_directories.load_template_source',
-#     'django.template.loaders.eggs.load_template_source',
 )
 
 MIDDLEWARE_CLASSES = (
@@ -77,7 +74,6 @@
     'conifer.middleware.genshi_locals.ThreadLocals',
     'django.middleware.locale.LocaleMiddleware',
     'babeldjango.middleware.LocaleMiddleware',
-    # TransactionMiddleware should be last...
     'django.middleware.transaction.TransactionMiddleware',
 )
 
@@ -97,25 +93,31 @@
 AUTH_PROFILE_MODULE = 'syrup.UserProfile'
 
 
-AUTHENTICATION_BACKENDS = (
-    'django.contrib.auth.backends.ModelBackend',
-    # uncomment for EG authentication:
-    #'conifer.custom.auth_evergreen.EvergreenAuthBackend',
-)
+AUTHENTICATION_BACKENDS = [
+    'django.contrib.auth.backends.ModelBackend'
+]
 
+#---------------------------------------------------------------------------
+# local_settings.py
 
-EVERGREEN_GATEWAY_SERVER = 'www.concat.ca'
-Z3950_CONFIG = ('zed.concat.ca', 210, 'OWA')  #OWA,OSUL,CONIFER
-SIP_HOST = ('localhost', 8080)
-
 try:
-    from private_local_settings import SIP_CREDENTIALS
+    from local_settings import *
+except ImportError:
+    raise Exception('You must create a local_settings.py file, and use it! '
+                    'As a starting point, see local_settings.py.example.')
 except:
-    # stuff that I really ought not check into svn...
-    SIP_CREDENTIALS = ('test', 'test', 'test')
-    pass
+    import sys
+    raise Exception('There is an error in your local_settings.py! '
+                    'Please investigate and repair.', sys.exc_value)
 
 
-#CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
-#CACHE_BACKEND = 'db://test_cache_table'
-#CACHE_BACKEND = 'locmem:///'
+#---------------------------------------------------------------------------
+# Further settings that depend upon local_settings.
+
+TEMPLATE_DEBUG = DEBUG
+
+if EVERGREEN_AUTHENTICATION:
+    AUTHENTICATION_BACKENDS.extend(
+        ['conifer.custom.auth_evergreen.EvergreenAuthBackend',
+         ])
+



More information about the open-ils-commits mailing list