On Sep 23, 6:19 pm, Greg Milby <[email protected]> wrote:
> are you trying to call the same file twice?

Nope, don't even know how I could do this...

The environment in which I use web.py is a daemon with multiple
processes manages via the "multiprocessing" module.  Many different
kinds of workers work on different queues.  One of the workers is a
HTTP-REST interface to submit jobs to the initial queue.  That's what
I use web.py for...  So from the command line, I launch the daemon
process that spans and supervises all workers, including web.py...

I looked through the source and found a solution:

      import web
      class MyApplication(web.application):
          def run(self, port=8080, *middleware):
              func = self.wsgifunc(*middleware)
              return web.httpserver.runsimple(func, ('0.0.0.0', port))
      #--------------------------
      urls = ('/', 'hello')
      class hello:
          def GET(self):
              return 'Hello'

      if __name__ == "__main__":
          app = MyApplication(urls, globals())
          app.run(port=8888)

Since I don't need cgi etc., that works for me.  Redefining "run" in a
subclass seemed to be the easiest way..

In case you like the optional "port" argument in application.run, I
could possibly prepare a patch..  Let me know.

best cheers
-b

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to