[Repoze-checkins] r643 - in repoze.grok/trunk: . repoze/grok/scripts repoze/grok/skel

Carlos de la Guardia cguardia at yahoo.com
Sat Jan 19 17:22:32 UTC 2008


Author: Carlos de la Guardia <cguardia at yahoo.com>
Date: Sat Jan 19 12:22:31 2008
New Revision: 643

Log:
Fixes for mod_wsgi deployment:
- Added a working sample grok.wsgi script and modified mkinstance to copy it to the sandbox bin directory on install.
- Removed grok.wsgi from the list of console-scripts on setup.
- Modified sample apache2.conf to use the new mod_wsgi 2.0 directives and be identical to the example on the web site.



Added:
   repoze.grok/trunk/repoze/grok/skel/sample-grok.wsgi
Modified:
   repoze.grok/trunk/repoze/grok/scripts/initialize.py
   repoze.grok/trunk/repoze/grok/skel/sample-apache2.conf
   repoze.grok/trunk/setup.py

Modified: repoze.grok/trunk/repoze/grok/scripts/initialize.py
==============================================================================
--- repoze.grok/trunk/repoze/grok/scripts/initialize.py	(original)
+++ repoze.grok/trunk/repoze/grok/scripts/initialize.py	Sat Jan 19 12:22:31 2008
@@ -33,8 +33,9 @@
 
     etc = os.path.join(sandbox, 'etc')
     var = os.path.join(sandbox, 'var')
+    bin = os.path.join(sandbox, 'bin')
 
-    for directory in etc, var:
+    for directory in etc, var, bin:
         if not os.path.exists(directory):
             os.makedirs(directory)
 
@@ -53,6 +54,13 @@
         if not os.path.exists(targetfile):
             open(targetfile, 'w').write(result)
 
+    template = open(os.path.join(skel, 'sample-grok.wsgi'), 'r').read()
+    result = rewrite(template, sandbox=sandbox)
+    targetfile = os.path.join(sandbox, 'bin', 'grok.wsgi')
+    if not os.path.exists(targetfile):
+        open(targetfile, 'w').write(result)
+        os.chmod(targetfile, 0755)
+
     grok_apps = os.path.join(etc, 'grok-apps')
     if not os.path.exists(grok_apps):
         os.makedirs(grok_apps)

Modified: repoze.grok/trunk/repoze/grok/skel/sample-apache2.conf
==============================================================================
--- repoze.grok/trunk/repoze/grok/skel/sample-apache2.conf	(original)
+++ repoze.grok/trunk/repoze/grok/skel/sample-apache2.conf	Sat Jan 19 12:22:31 2008
@@ -1,17 +1,12 @@
-WSGIPythonExecutable ${sandbox}/bin/python
-WSGIDaemonProcess thegroup threads=1 processes=4 maximum-requests=10000
-
-<Directory ${sandbox}/bin>
-  Order deny,allow
-  Allow from all
-</Directory>
+WSGIPythonHome ${sandbox}
+WSGIDaemonProcess grok threads=1 processes=4 maximum-requests=10000 python-path=${sandbox}/lib/python2.4/site-packages
 
 <VirtualHost *:80>
-  ServerName www.repoze.org
-  ServerAdmin repoze-dev at repoze.org
-  DocumentRoot ${sandbox}/static
-  WSGIScriptAlias /site ${sandbox}/bin/zope2.wsgi
-  WSGIProcessGroup thegroup
+  ServerName my.machine.local
+  WSGIScriptAlias /site ${sandbox}/bin/grok.wsgi
+  WSGIProcessGroup grok
   WSGIPassAuthorization On
-  SetEnv HTTP_X_VHM_HOST http://www.repoze.org/site
+  WSGIReloadMechanism Process
+  SetEnv HTTP_X_VHM_HOST http://my.machine.local/site
+  SetEnv PASTE_CONFIG ${sandbox}/etc/zope2.ini
 </VirtualHost>

Added: repoze.grok/trunk/repoze/grok/skel/sample-grok.wsgi
==============================================================================
--- (empty file)
+++ repoze.grok/trunk/repoze/grok/skel/sample-grok.wsgi	Sat Jan 19 12:22:31 2008
@@ -0,0 +1,13 @@
+"""
+
+Stub for running under mod_wsgi.  Intended to be used as a
+'WSGIScriptAlias' within the Apache configuration, e.g.::
+
+WSGIScriptAlias /site /path/to/sandbox/etc/grok.wsgi
+
+""" 
+import os
+from paste.deploy import loadapp
+
+ini = '${sandbox}/etc/grok.ini'
+application = loadapp('config:%s' % ini)

Modified: repoze.grok/trunk/setup.py
==============================================================================
--- repoze.grok/trunk/setup.py	(original)
+++ repoze.grok/trunk/setup.py	Sat Jan 19 12:22:31 2008
@@ -88,9 +88,6 @@
                'grokproject >= 0.6',
                ] + grok_requires,
       entry_points = """\
-      [console_scripts]
-      grok.wsgi = repoze.grok.scripts.grok.wsgi:main
-
       [paste.server_runner]
       zserver = repoze.grok.server:run_zserver
 


More information about the Repoze-checkins mailing list