Bottle and gevent
I’m new using Python, also Bottle. After learning some frameworks I decide give a chance to Bottle as web framework. Default WSGIRefServer (for development) give me some lack while refresh http get from Google Chrome fast.
I think I need replace the default one: gevent. Searching anywhere found nothing about integrating Bootle on gevent. So here is mind, feel free to correct.
from bottle import Bottle, run, ServerAdapter
myapp = Bottle()
@myapp.route('/')
def index():
return "Hello World"
class GEventServer(ServerAdapter):
""" Fast HTTP Server """
def run(self, handler):
from gevent import monkey; monkey.patch_all()
from gevent.wsgi import WSGIServer
WSGIServer((self.host, self.port), handler).serve_forever()
run(app=myapp, server=GEventServer, host='localhost', port=8080)
Advertisement
hey, good job
but when i try with reloader options then not works…
thanks ..
You’re right, by using Gevent adapter it is not able to use the reloader (not suitable for debugging purpose)