Flask Snippets

Reloading with other WSGI servers

By Shane Holloway filed in Utilities

If you want to use reloading with a different WSGI server, you can use werkzeug.serving.run_with_reloader directly.

For example, this snippet uses one of gevent's WSGIServers:

import gevent.wsgi
import werkzeug.serving

@werkzeug.serving.run_with_reloader
def runServer():
    app.debug = True

    ws = gevent.wsgi.WSGIServer(('', 5000), app)
    ws.serve_forever()

This snippet by Shane Holloway can be used freely for anything you like. Consider it public domain.

Comments