[PEAK] Serving a Nevow WSGI app with 'peak supervise'

Phillip J. Eby pje at telecommunity.com
Mon Jul 18 12:59:03 EDT 2005

At 12:42 PM 7/18/2005 -0400, Andy Gross wrote:

>I'd like to serve a Nevow app with FastCGI and PEAK's 'supervise'
>tool, but I keep stumbling over exactly how to set this up.  Forgive
>me if I've missed something obvious in the docs or on the list ..
>Anyways, Nevow has an adapter function that takes a Nevow page and
>returns a standard WSGI calllable.  What's the right magic for
>setting up a 'supervise' instance to serve this?
>I'm currently doing something like:
>#!/usr/local/bin/peak supervise
>Command FastCGI fd.socket:stdin WSGI import:my_app.wsgi_app
>PidFile /var/run/my_app.pid
>I can't seem to figure out what my_app.wsgi_app needs to be.  Given a
>(non-peak) WSGI-callable, is it possible to make this work?

It should work with that setup, if wsgi_app is a WSGI application 
object.  Does it work with a trivial WSGI app, e.g.:

     def simple_app(environ, start_response):
         """Simplest possible application object"""
         status = '200 OK'
         response_headers = [('Content-type','text/plain')]
         start_response(status, response_headers)
         return ['Hello world!\n']

If it doesn't work with this app as 'wsgi_app', then there's something 
wrong with the setup.  (E.g. the Command is wrong in some way that's not 
immediately apparent to me.)  If it *does* work with this app then there's 
something wrong with your current wsgi_app object.

Another way to test this is to use 'peak launch WSGI 
import:my_app.wsgi_app' and see if you can get the app to come up in your 
browser.  If it doesn't work, then the app is probably what's broken.

More information about the PEAK mailing list