python - Non blocking CherryPy does not receive anything -
i trying run cherrypy cherrypy.engine.start instead of cherrypy.quickstart. that's because want run cherrypy in non blocking state start , stop web server within functional tests py.test.
this works fine:
cherrypy.quickstart(webservertest(none), config=testconf) the response curl is:
curl --head http://127.0.0.1:1026/index http/1.1 200 ok date: thu, 08 aug 2013 12:54:37 gmt content-length: 0 content-type: text/html;charset=utf-8 server: cherrypy/3.2.2 but it's blocking rest of script execute.
however not work:
testconf = path.join(path.dirname(__file__), 'webservertest.conf') web_server = webservertest(none) cherrypy.tree.mount(web_server, "", config=testconf) cherrypy.engine.start() time.sleep(60) cherrypy.engine.stop() the response curl is:
curl --head http://127.0.0.1:1026/index curl: (7) couldn't connect host
adding cherrypy.engine.block() aftet cherrypy.engine.start not solve problem.
so how can make work cherrypy.engine.start()?
the webservertest.conf config file is:
[global] server.socket_host = "127.0.0.1" server.socket_port = 1026 server.thread_pool = 10
you need pass conf cherrypy.config.update(conf). global config (including server host , port), whereas tree.mount call sets config particular app. read source code of quickstart see gory details.
Comments
Post a Comment