2023-06-03 05:07:59 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
# Import CherryPy
|
|
|
|
import cherrypy
|
|
|
|
|
|
|
|
|
|
|
|
def shim(app):
|
|
|
|
cherrypy.server.unsubscribe()
|
|
|
|
server = cherrypy._cpserver.Server()
|
|
|
|
|
2023-06-03 05:24:03 +00:00
|
|
|
def _run(host="0.0.0.0", port=8080, pool_size=16, environment="production"):
|
|
|
|
cherrypy.config.update(
|
|
|
|
{
|
|
|
|
"environment": environment,
|
|
|
|
"engine.autoreload.on": False,
|
|
|
|
"log.screen": True,
|
|
|
|
}
|
|
|
|
)
|
2023-06-03 07:24:13 +00:00
|
|
|
cherrypy.tree.graft(app, "/")
|
2023-06-03 05:24:03 +00:00
|
|
|
|
2023-06-03 07:24:13 +00:00
|
|
|
server.socket_host = host
|
|
|
|
server.socket_port = port
|
|
|
|
server.thread_pool = pool_size
|
2023-06-03 05:07:59 +00:00
|
|
|
server.subscribe()
|
2023-06-03 07:24:13 +00:00
|
|
|
|
2023-06-03 05:07:59 +00:00
|
|
|
cherrypy.engine.start()
|
|
|
|
cherrypy.engine.block()
|
|
|
|
|
|
|
|
server.run = _run
|
|
|
|
|
|
|
|
return server
|