Created
January 7, 2020 16:19
-
-
Save Cellebyte/e131af3564e322eb6b5613c7733b8d51 to your computer and use it in GitHub Desktop.
Initialization for serving a WSGI app.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
from cheroot.wsgi import Server as WSGIServer, PathInfoDispatcher | |
except ImportError: | |
from cherrypy.wsgiserver import CherryPyWSGIServer as WSGIServer, WSGIPathInfoDispatcher as PathInfoDispatcher | |
from .your_module import app | |
d = PathInfoDispatcher({'/': app}) | |
server = WSGIServer(('0.0.0.0', 5000), d) | |
if __name__ == '__main__': | |
try: | |
server.start() | |
except KeyboardInterrupt: | |
server.stop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment