Jeff Shell wrote: > But in theory, since Zope 3 has `zope.app.wsgi`, I could serve from... > anything? I guess that since I don't think about serving via Twisted > any more than I thought about serving via ZServer, I could put > CherryPy, mod_wsgi, whatever else underneath, right?
In theory you can set up Zope 3 using something like: [app:main] paste.app_factory = some_function_yet_to_be_written I thought zope.paste did this, but it's a little wonky now that I look at it. It seems to basically read INSTANCE_HOME and create a single Zope WSGI app, and then kind of minimally plug into it. That function would more ideally look like: from zope.app.wsgi import getWSGIApplication def make_zope_app(global_conf, instance_home=None, configfile=None): if configfile is None: configfile = global_conf.get('configfile') if configfile is None: if instance_home is None: instance_home = global_conf.get('instance_home') if not instance_home: raise ValueError( 'You must give a configfile or instance_home value') configfile = os.path.join(instance_home, 'etc', 'zope.conf') app = getWSGIApplication(configfile) return app Then in Zope's setup.py: setup(... entry_points=""" [paste.app_factory] main = zope.some_module:make_zope_app """) Then you'd configure it like: [app:main] use = egg:Zope # Same directory as the config file: instance_home = %(here)s # instead of "use", and if you didn't set up the entry point: paste.app_factory = zope.some_module.make_zope_app And you'd set up a server like: [app:main] # CherryPy doesn't natively provide this entry point... use = egg:PasteScript#cherrypy # or... #use = egg:Paste#http, egg:Flup#scgi, etc host = 0.0.0.0 port = 8080 Put both those sections in one file (say, deploy.ini) and then do: $ paster serve deploy.ini And it'll start up. Additionally, instead of plugging that app directly into a server, you could wrap it with different kinds of middleware, which is where it starts looking a bit more interesting. For instance, for Paste's interactive debugger: [app:main] use = egg:Zope ... filter-with = egg:Paste#evalerror Though that probably won't quite work, because we don't all agree on a way to indicate to the app that it shouldn't catch unexpected errors (Zope uses environ['wsgi.handleErrors']); which is incidentally what this proposed spec would help us agree on: http://wsgi.org/wsgi/Specifications/throw_errors -- Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com