Skip to content

Instantly share code, notes, and snippets.

@rafaelhdr
Last active February 7, 2024 19:04
Show Gist options
  • Save rafaelhdr/96547498b515f6c0b7f8383f49a8aa5c to your computer and use it in GitHub Desktop.
Save rafaelhdr/96547498b515f6c0b7f8383f49a8aa5c to your computer and use it in GitHub Desktop.
Cherrypy server with Flask application
# Reason for choosing cherrypy
# https://blog.appdynamics.com/engineering/a-performance-analysis-of-python-wsgi-servers-part-2/
#
# Flask application based on Quickstart
# http://flask.pocoo.org/docs/0.12/quickstart/
#
# CherryPy documentation for this
# http://docs.cherrypy.org/en/latest/deploy.html#wsgi-servers
# http://docs.cherrypy.org/en/latest/advanced.html#host-a-foreign-wsgi-application-in-cherrypy
# Install: pip install cherrypy
from hello import app
import cherrypy
cherrypy.tree.graft(app.wsgi_app, '/')
cherrypy.config.update({'server.socket_host': '0.0.0.0',
'server.socket_port': 5000,
'engine.autoreload.on': False,
})
if __name__ == '__main__':
cherrypy.engine.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment