flask-gopher icon indicating copy to clipboard operation
flask-gopher copied to clipboard

Using WSGI server (like Gunicorn) with Flask-Gopher

Open tyteen4a03 opened this issue 3 years ago • 1 comments

Hi, very nice library. Could you confirm whether it's possible to serve this application behind a WSGI server, and how?

tyteen4a03 avatar Sep 25 '22 03:09 tyteen4a03

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.

michael-lazar avatar Sep 26 '22 13:09 michael-lazar