flask-gopher
flask-gopher copied to clipboard
Using WSGI server (like Gunicorn) with Flask-Gopher
Hi, very nice library. Could you confirm whether it's possible to serve this application behind a WSGI server, and how?
Hi,
Because WSGI servers only know how to handle HTTP traffic, you need to teach them to "speak" gopher. For the built-in Flask server (i.e. werkzeug), this is what I am doing with the GopherRequestHandler class.
https://github.com/michael-lazar/flask-gopher/blob/master/flask_gopher/flask_gopher.py#L591
Werkzeug is nice because it allows you to override the request handling with a simple python class. For production-grade servers like gunicorn I would guess that it's not so simple, but I haven't really looked into it.