Skip to content

Instantly share code, notes, and snippets.

@semyont
Created June 4, 2017 08:35
Show Gist options
  • Save semyont/90dc128caaeefa40f2e964d1d9e56905 to your computer and use it in GitHub Desktop.
Save semyont/90dc128caaeefa40f2e964d1d9e56905 to your computer and use it in GitHub Desktop.
gevent wsgi tornado example
import os.path
import tornado.web
import tornado.wsgi
import gevent.wsgi
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.render('main.html', page_title="", body_id="", messages="whatever",title="home")
settings = {
"static_path":os.path.join(os.path.dirname(__file__),'static'),
"template_path":"templates",
}
application = tornado.wsgi.WSGIApplication([
(r"/", pure_tornado.MainHandler),
],**pure_tornado.settings)
if __name__ == "__main__":
server = gevent.wsgi.WSGIServer(('', 8080), application)
server.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment