baby steps toward a good mod_python deployment.
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Mon, 6 Apr 2009 01:01:28 +0000 (01:01 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Mon, 6 Apr 2009 01:01:28 +0000 (01:01 +0000)
This works as is, with a overly-controlling Apache environment:

<Location "/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE conifer.settings
    #PythonOption django.root /syrup
    PythonOption django.root
    PythonDebug Off
    PythonPath "['/home/graham/projects/evergreen/servres/'] + sys.path"
</Location>

git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@292 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/genshi_support.py
conifer/libsystems/evergreen/support.py
conifer/settings.py
conifer/syrup/views.py
conifer/templates/master.xhtml
conifer/urls.py

index 76d2fbb..54c9ec6 100644 (file)
@@ -26,7 +26,7 @@ def template_loaded(template):
         template.filters.insert(0, Translator(_))
 
 
-dirs = ['templates']
+dirs = [settings.HERE('templates')]
 
 loader = TemplateLoader(dirs, auto_reload=True, callback=template_loaded)
 
index 4e4454f..13459b8 100644 (file)
@@ -4,7 +4,7 @@ from urllib import quote
 import simplejson as json
 from xml.etree import ElementTree
 import re
-import sys
+import sys, os
 
 #------------------------------------------------------------
 # Configuration
@@ -24,6 +24,8 @@ LOCALE = 'en-US'
 # FM_IDL_LOCATION = 'file:fm_IDL.xml'
 
 FM_IDL_LOCATION = 'http://dwarf.cs.uoguelph.ca/reports/fm_IDL.xml'
+here = lambda s: os.path.join(os.path.dirname(__file__), s)
+FM_IDL_LOCATION = 'file:' + here('fm_IDL.xml')
 
 #------------------------------------------------------------
 # parse fm_IDL, to build a field-name-lookup service.
index e3816e5..eb79a7e 100644 (file)
@@ -5,10 +5,10 @@
 
 import os
 
-BASE_DIRECTORY = os.path.abspath(os.getcwd())
+BASE_DIRECTORY = os.path.abspath(os.path.dirname(__file__))
 HERE = lambda s: os.path.join(BASE_DIRECTORY, s)
 
-DEBUG = True
+DEBUG = False
 TEMPLATE_DEBUG = DEBUG
 
 ADMINS = (
@@ -130,3 +130,5 @@ try:
     from private_local_settings import SIP_HOST, SIP_CREDENTIALS
 except:
     pass
+
+CACHE_BACKEND = 'locmem:///'
index 892cc70..c7d0949 100644 (file)
@@ -1379,3 +1379,9 @@ def phys_mark_arrived_match(request):
     return g.render('phys/mark_arrived_outcome.xhtml')
 
 
+
+def custom_error_handler(request):
+    cls, inst, tb = sys.exc_info()
+    #fixme, set 50x code.
+    return simple_message(_('Error: %s') % repr(inst),
+                          repr((request.__dict__, inst)))
index 48af57b..7a8cee5 100644 (file)
@@ -1,6 +1,7 @@
 <?python
 app_name = _('Syrup E-Reserve System')
 search = _('search...')
+import os
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:py="http://genshi.edgewall.org/"
@@ -22,6 +23,7 @@ search = _('search...')
       <div id="outer">
       <div id="brandheader">
        <div style="float: right; font-size: x-large; padding: 12; color: #888;">
+         ${os.getpid()}
          ${app_name}
        </div>
        <img src="/static/institution-logo.png" style="height: 50;"/>
index cbdf790..cf2d782 100644 (file)
@@ -20,7 +20,10 @@ urlpatterns = patterns('',
         {'document_root': settings.MEDIA_ROOT}),
     (r'^accounts/(?P<path>.*)$', 'conifer.syrup.views.auth_handler'),
 
-    (r'^syrup/setlang', 'conifer.syrup.views.setlang'),
+#    (r'^syrup/setlang', 'conifer.syrup.views.setlang'),
     (r'^syrup/i18n/', include('django.conf.urls.i18n')),
 
 )
+
+if not settings.DEBUG:
+    handler500 = 'conifer.syrup.views.custom_error_handler'