[IMP] serve application via werkzeug's runner
bzr revid: xmo@openerp.com-20110902071152-0oz8a526aeakindr
This commit is contained in:
parent
55250f1006
commit
6e739caf10
|
@ -1,11 +1,16 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import optparse,os,sys,tempfile
|
import optparse
|
||||||
|
import os
|
||||||
|
import signal
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
|
||||||
import cherrypy
|
import cherrypy
|
||||||
import cherrypy.lib.static
|
import cherrypy.lib.static
|
||||||
|
import werkzeug.serving
|
||||||
|
|
||||||
optparser = optparse.OptionParser()
|
optparser = optparse.OptionParser()
|
||||||
optparser.add_option("-p", "--port", dest="server.socket_port", default=8002,
|
optparser.add_option("-p", "--port", dest="socket_port", default=8002,
|
||||||
help="listening port", type="int", metavar="NUMBER")
|
help="listening port", type="int", metavar="NUMBER")
|
||||||
optparser.add_option("-s", "--session-path", dest="tools.sessions.storage_path",
|
optparser.add_option("-s", "--session-path", dest="tools.sessions.storage_path",
|
||||||
default=os.path.join(tempfile.gettempdir(), "cpsessions"),
|
default=os.path.join(tempfile.gettempdir(), "cpsessions"),
|
||||||
|
@ -45,14 +50,13 @@ def main(options):
|
||||||
if not os.path.exists(cherrypy.config['tools.sessions.storage_path']):
|
if not os.path.exists(cherrypy.config['tools.sessions.storage_path']):
|
||||||
os.makedirs(cherrypy.config['tools.sessions.storage_path'], 0700)
|
os.makedirs(cherrypy.config['tools.sessions.storage_path'], 0700)
|
||||||
|
|
||||||
return base.common.Root()
|
return cherrypy.tree.mount(base.common.Root())
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
(o, args) = optparser.parse_args(sys.argv[1:])
|
(options, args) = optparser.parse_args(sys.argv[1:])
|
||||||
o = dict((k, v) for k, v in vars(o).iteritems() if v is not None)
|
o = dict((k, v) for k, v in vars(options).iteritems() if v is not None)
|
||||||
|
|
||||||
cherrypy.tree.mount(main(o))
|
werkzeug.serving.run_simple(
|
||||||
cherrypy.server.subscribe()
|
'0.0.0.0', options.socket_port, main(o),
|
||||||
cherrypy.engine.start()
|
use_reloader=True, threaded=True)
|
||||||
cherrypy.engine.block()
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue