29 lines
623 B
Python
29 lines
623 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
# Import CherryPy
|
||
|
import cherrypy
|
||
|
|
||
|
|
||
|
def shim(app):
|
||
|
# Mount the application
|
||
|
cherrypy.tree.graft(app, "/")
|
||
|
|
||
|
# Unsubscribe the default server
|
||
|
cherrypy.server.unsubscribe()
|
||
|
|
||
|
# Instantiate a new server object
|
||
|
server = cherrypy._cpserver.Server()
|
||
|
|
||
|
def _run(host="0.0.0.0", port=8080, pool_size=16):
|
||
|
# Configure the server object
|
||
|
server.socket_host = host
|
||
|
server.socket_port = port
|
||
|
server.thread_pool = pool_size
|
||
|
server.subscribe()
|
||
|
cherrypy.engine.start()
|
||
|
cherrypy.engine.block()
|
||
|
|
||
|
server.run = _run
|
||
|
|
||
|
return server
|