Flask Snippets

Snippets are unofficial and unmaintained.

This is an archived view of user-submitted snippets. Despite being hosted on the Flask site, they are not official. No Flask maintainer has curated or checked the snippets for security, correctness, or design.

Reloading with other WSGI servers

Posted by Shane Holloway on 2010-07-16 @ 18:07 and 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