[Checkins] SVN: Sandbox/baijum/z3hello/trunk/ Use WSGI

Baiju M baiju.m.mail at gmail.com
Wed Apr 1 21:02:15 EDT 2009


Log message for revision 98784:
  Use WSGI
  

Changed:
  U   Sandbox/baijum/z3hello/trunk/README.txt
  U   Sandbox/baijum/z3hello/trunk/buildout.cfg
  A   Sandbox/baijum/z3hello/trunk/deploy.ini
  A   Sandbox/baijum/z3hello/trunk/log/
  U   Sandbox/baijum/z3hello/trunk/setup.py
  A   Sandbox/baijum/z3hello/trunk/site.zcml
  A   Sandbox/baijum/z3hello/trunk/src/z3hello/startup.py
  A   Sandbox/baijum/z3hello/trunk/var/
  A   Sandbox/baijum/z3hello/trunk/var/blobs/
  A   Sandbox/baijum/z3hello/trunk/zope.conf

-=-
Modified: Sandbox/baijum/z3hello/trunk/README.txt
===================================================================
--- Sandbox/baijum/z3hello/trunk/README.txt	2009-04-01 23:48:08 UTC (rev 98783)
+++ Sandbox/baijum/z3hello/trunk/README.txt	2009-04-02 01:02:15 UTC (rev 98784)
@@ -2,9 +2,7 @@
 z3hello
 *******
 
-A Zope 3 hello application for demonstarting
-use of buildout and zc.zope3recipes for building
-application soley from eggs.
+A Zope 3 hello application 
 
 Releases
 ********

Modified: Sandbox/baijum/z3hello/trunk/buildout.cfg
===================================================================
--- Sandbox/baijum/z3hello/trunk/buildout.cfg	2009-04-01 23:48:08 UTC (rev 98783)
+++ Sandbox/baijum/z3hello/trunk/buildout.cfg	2009-04-02 01:02:15 UTC (rev 98784)
@@ -1,23 +1,16 @@
 [buildout]
 develop = .
-parts = helloapp instance test
+parts = app test 
 
-[zope3]
-location =
-
-[helloapp]
-recipe = zc.zope3recipes:app
-site.zcml = <include package="z3hello" file="application.zcml" />
+[app]
+recipe = zc.recipe.egg
 eggs = z3hello
+       z3c.evalexception>=2.0
+       Paste
+       PasteScript
+       PasteDeploy
+interpreter = python
 
-[instance]
-recipe = zc.zope3recipes:instance
-application = helloapp
-zope.conf = ${database:zconfig}
-
-[database]
-recipe = zc.recipe.filestorage
-
 [test]
 recipe = zc.recipe.testrunner
 defaults = ['--tests-pattern', '^f?tests$']

Added: Sandbox/baijum/z3hello/trunk/deploy.ini
===================================================================
--- Sandbox/baijum/z3hello/trunk/deploy.ini	                        (rev 0)
+++ Sandbox/baijum/z3hello/trunk/deploy.ini	2009-04-02 01:02:15 UTC (rev 98784)
@@ -0,0 +1,7 @@
+[app:main]
+use = egg:z3hello
+
+[server:main]
+use = egg:Paste#http
+host = 127.0.0.1
+port = 8080

Modified: Sandbox/baijum/z3hello/trunk/setup.py
===================================================================
--- Sandbox/baijum/z3hello/trunk/setup.py	2009-04-01 23:48:08 UTC (rev 98783)
+++ Sandbox/baijum/z3hello/trunk/setup.py	2009-04-02 01:02:15 UTC (rev 98784)
@@ -47,4 +47,8 @@
 
       include_package_data = True,
       zip_safe = False,
+      entry_points = """
+      [paste.app_factory]
+      main = z3hello.startup:application_factory
+      """
       )

Added: Sandbox/baijum/z3hello/trunk/site.zcml
===================================================================
--- Sandbox/baijum/z3hello/trunk/site.zcml	                        (rev 0)
+++ Sandbox/baijum/z3hello/trunk/site.zcml	2009-04-02 01:02:15 UTC (rev 98784)
@@ -0,0 +1,6 @@
+<configure
+  xmlns='http://namespaces.zope.org/zope'>
+
+  <include package="z3hello" file="application.zcml" />
+
+</configure>

Added: Sandbox/baijum/z3hello/trunk/src/z3hello/startup.py
===================================================================
--- Sandbox/baijum/z3hello/trunk/src/z3hello/startup.py	                        (rev 0)
+++ Sandbox/baijum/z3hello/trunk/src/z3hello/startup.py	2009-04-02 01:02:15 UTC (rev 98784)
@@ -0,0 +1,35 @@
+import os
+import sys
+import code
+import zdaemon.zdctl
+import zope.app.wsgi
+import zope.app.debug
+
+def application_factory(global_conf, conf='zope.conf'):
+    zope_conf = os.path.join(global_conf['here'], conf)
+    return zope.app.wsgi.getWSGIApplication(zope_conf)
+
+def interactive_debug_prompt(zope_conf='zope.conf'):
+    db = zope.app.wsgi.config(zope_conf)
+    debugger = zope.app.debug.Debugger.fromDatabase(db)
+    # Invoke an interactive interpreter shell
+    banner = ("Welcome to the interactive debug prompt.\n"
+              "The 'root' variable contains the ZODB root folder.\n"
+              "The 'app' variable contains the Debugger, 'app.publish(path)' "
+              "simulates a request.")
+    code.interact(banner=banner, local={'debugger': debugger,
+                                        'app':      debugger,
+                                        'root':     debugger.root()})
+
+class ControllerCommands(zdaemon.zdctl.ZDCmd):
+
+    def do_debug(self, rest):
+        interactive_debug_prompt()
+
+    def help_debug(self):
+        print "debug -- Initialize the application, providing a debugger"
+        print "         object at an interactive Python prompt."
+
+def zdaemon_controller(zdaemon_conf='zdaemon.conf'):
+    args = ['-C', zdaemon_conf] + sys.argv[1:]
+    zdaemon.zdctl.main(args, options=None, cmdclass=ControllerCommands)

Added: Sandbox/baijum/z3hello/trunk/zope.conf
===================================================================
--- Sandbox/baijum/z3hello/trunk/zope.conf	                        (rev 0)
+++ Sandbox/baijum/z3hello/trunk/zope.conf	2009-04-02 01:02:15 UTC (rev 98784)
@@ -0,0 +1,46 @@
+# Identify the component configuration used to define the site:
+site-definition site.zcml
+
+<zodb>
+  # Wrap standard FileStorage with BlobStorage proxy to get ZODB blobs
+  # support.
+  # This won't be needed with ZODB 3.9, as its FileStorage supports
+  # blobs by itself. If you use ZODB 3.9, remove the proxy and specify
+  # the blob-dir parameter right in in filestorage, just after path.
+  <blobstorage>
+    blob-dir var/blobs
+    <filestorage>
+      path var/Data.fs
+    </filestorage>
+  </blobstorage>
+
+# Uncomment this if you want to connect to a ZEO server instead:
+#  <zeoclient>
+#    server localhost:8100
+#    storage 1
+#    # ZEO client cache, in bytes
+#    cache-size 20MB
+#    # Uncomment to have a persistent disk cache
+#    #client zeo1
+#  </zeoclient>
+</zodb>
+
+<eventlog>
+  # This sets up logging to both a file and to standard output (STDOUT).
+  # The "path" setting can be a relative or absolute filesystem path or
+  # the tokens STDOUT or STDERR.
+
+  <logfile>
+    path log/z3.log
+    formatter zope.exceptions.log.Formatter
+  </logfile>
+
+  <logfile>
+    path STDOUT
+    formatter zope.exceptions.log.Formatter
+  </logfile>
+</eventlog>
+
+# Comment this line to disable developer mode.  This should be done in
+# production
+devmode on



More information about the Checkins mailing list