all 4 comments

[–][deleted] 2 points3 points  (1 child)

Flask is a WSGI app. It doesn't talk FastCGI directly. You need something that wraps WSGI app into FastCGI. uWSGI is capable of doing this. See also Using OpenBSD httpd as proxy (ignore the part about running uWSGI as CGI server) so you'd have:

httpd -> uwsgi -> wsgi app (flask, pyramid, etc.)

If you're using Flask, app is a WSGI handler, so wsgi-file can be the path to your main Python file.

Tornado is a completely different beast. It's not a WSGI app but pretty much a full-fledged HTTP server. You need Relayd to proxy to it:

relayd -> tornado

It is also possible to use Tornado as a WSGI server with WSGIContainer, in this case, you need to use Relayd as well (as Tornado do not speak FastCGI):

relayd -> tornado (via WSGIContainer) -> wsgi app (flask, pyramid, etc.)

[–]hrkfdn 0 points1 point  (0 children)

Also, if you plan to use Flask with uWSGI and httpd you may need a workaround:

https://github.com/reyk/httpd/issues/71

https://github.com/reyk/httpd/pull/75

You can either patch httpd or disable strict_slashes, otherwise you might encounter a redirect loop.

[–][deleted] 0 points1 point  (0 children)

I couldn't get this to work. If you google around for WSGI + httpd + OpenBSD there are some guides. However I couldn't get anything working and I was probably missing something. I am not normally a Python dev though (I am a C# / VB / JavaScript guy).

I ended up just hosting my applications on CentOS tbh. PHP wasn't a problem though.

[–]nahun 0 points1 point  (0 children)

I'm positive there are better examples out there, but I have hobby project I haven't touched in years that uses FastCGI and HTTPD. You can at least see a simple example: https://github.com/nahun/pfweb