botapp = bottle.app()
for Route in (mainappRoute,): #handle multiple files containing routes
botapp.merge(Route)
botapp = SessionMiddleware(botapp, beakerconfig) #in case you are using beaker sessions
botapp = WhiteNoise(botapp) #in case you want whitenoise to handle static files
botapp.add_files(staticfolder, prefix='static/') #add static route to whitenoise
server = WSGIServer(("0.0.0.0", int(80)), botapp) #gevent async web server
def shutdown():
print('Shutting down ...')
server.stop(timeout=60)
exit(signal.SIGTERM)
gevent.signal(signal.SIGTERM, shutdown)
gevent.signal(signal.SIGINT, shutdown) #CTRL C
server.serve_forever() #spawn the server
这实际上是基于您通过的WSGI服务器托管框架的。最好的解决办法是让它通过gevent。在
你可以清除白噪音和瓶子配置,如果他们不是必要的,我把他们作为一个例子,并建议你使用他们,如果这是朝外的。在
这在每个连接上都是完全异步的。在
相关问题 更多 >
编程相关推荐