List Info

Thread: CherryPy WSGI without flup, and auto-reload




CherryPy WSGI without flup, and auto-reload
country flaguser name
United Kingdom
2007-10-18 07:40:15
After much experimentation, I finally got CherryPy working
behind
lighthttpd, but I had to use flup.

This seems to work (and I'm posting my configuration below
in case it
helps anyone), but I have two questions:

1) CherryPy is supposed to have its own WSGI server, so how
do I use
that and get rid of flup (which is one more thing to
configure when
deploying on servers)?

2) The auto-reload feature does not work under this
configuration (I
was previously using CherryPy behind lighttpd proxy, and
auto-reload
worked fine). And Control-C no longer stops the server. Is
there
something I can do to get these back?


Here is the Python program that creates and starts a trivial
WSGI
server:


import cherrypy as cp
from flup.server.scgi import WSGIServer

class MyApp:

    cp.expose
    def index(self):
        return 'This is a test.'

app = cp.tree.mount(MyApp())
#cp.server.quickstart()  # does not seem to be required
cp.engine.start(blocking = False)

s = WSGIServer(app)   # seems to use 4000 as default port
s.run()



And here is the lighttpd configuration (relevant extracts
only,
serves site at url "test.localhost", with static
content
under /static served directly by lighttpd):

server.modules = (
    "mod_rewrite",
    "mod_access",
    "mod_auth",
    "mod_accesslog",
    "mod_scgi")

$HTTP["host"] == "test.localhost" {
    server.document-root = "/var/www/test"
    $HTTP["url"] !~ "^/static/.*" {
        scgi.server = ( "" => 
            ((  "host" =>
"127.0.0.1", 
                "port" => 4000,
                "check-local" =>
"disable" 
            ))
        )
    }
}


Setting up and starting lighttpd, then running the Python
program, lets
you go to http://test.localhost in
your browser to view the app.

Any suggestions appreciated.

Thanks,
Andreas Kaempf (St. Albans, UK)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )