[Flask] Deploying Flask on Debian

David Nieder davidnieder at gmx.de
Wed May 4 06:41:54 EDT 2016


Sorry for the second mail, Alex. I didn't reply to the list the first time.

On 03.05.2016 22:05, Alex Hall wrote:
> Hello list,
> My work has a Google Cloud account, so my boss just made me a Debian
> server. Being virtual, I can't physically access it, but I've got SSH and
> SCP, so  same thing. No remote GUI, though, just command line.
>
> I've been looking up how to deploy Flask on Linux, Debian specifically, for
> a couple hours. I'm getting a *lot* of hits, but nothing that seems to be
> in line with anything else. Some tell me to use WSGI (which I expected),
> but others say mod_wsgi, and others UWSGI. Mod_wsgi might mean, some say,
> compiling it for Python3, but I'm on Python 2.7.9? Most assume I'm using a
> virtual environment, which I'm not, because Python and other web projects
> are the only things on this server. The Flask docs talk about UWSGI, then
> something called MGinx? I'm using Apache2, again on Debian 8.
>
> Is there a single tutorial or article that most people recommend? I'm not
> very experienced with Debian, but I'm fine with a command line interface in
> general. I've got Flask, Flask-WTF, and the pyodbc module I'll need, and
> now just want to get Flask running with Apache2 so Apache can serve my
> Flask app. Thanks.
>

Hello Alex
I'm using Apache and mod_wsgi for some years now without any bigger
problems. There is a section in the flask docs:
http://flask.pocoo.org/docs/0.10/deploying/mod_wsgi/

Altough the Apache configuration changed a bit with 2.4, which is the
version that comes with Debian 8.

If you search for "debian 8 mod_wsgi" or "debian mod_wsgi flask" you
will find a lot of guides (deploying a django app is very similar to a
flask app and ubuntu is similar to debian)

For a basic configuration you just need two things. A wsgi-file that
imports you flask app and a WSGIScriptAlias directive in your
apache/vhost config.

Chances are it won't work on your first try so keep an eye on the apache
error logs which should by in /var/log/apache2

I also would recommend using virtualenv but you can start without.


Good luck ;)
David

>
>
> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
>



More information about the Flask mailing list