librelist archives

« back to archive

Deployment best practices

Deployment best practices

From:
Mark Grey
Date:
2012-11-15 @ 18:32
Hey All,

Looking for some help understanding best practices deploying Flask.

I am led to understand that the best way to deploy a flask app on a bare
machine is some WSGI wrapper server (like gunicorn for ex) with nginx in
front as the proxy for virtual hosting / static files.  I am curious as to
why there seems to be such a strong consensus about this and if anybody has
had experience with alternative configurations.

Right now, I have a staging environment set up using TwistedWeb.  The
server is on a development machine and uses twisted VHostResource and
WSGIResource to setup all the virtual hosts our developers need to see the
latest commits they make live in their browsers.  I am hesitant to use this
in any live environment since I put it together myself as a quick and dirty
solution.  I'm not nearly familiar enough with the innards of Twisted to
feel confident with how I handled redirects and static routing, etc.

If one were to have multiple vhosts on a gunicorn (or any wrapper) /nginx
configuration, would I need to have multiple WSGI wrapper instances running
on different ports, one for each host, and have nginx proxy there?  Doesn't
this considerably complicate deployment?

Thanks for the help!

Re: [flask] Deployment best practices

From:
zhang yang
Date:
2012-11-15 @ 21:15
I just read this article:
Flask/WSGI Application Deployment with Ubuntu, Ansible, Nginx, Supervisor
and uWSGI
goo.gl/ma1UC
Hopefully, it is helpful.


On Thu, Nov 15, 2012 at 1:32 PM, Mark Grey <mark.asperia@gmail.com> wrote:

> Hey All,
>
> Looking for some help understanding best practices deploying Flask.
>
> I am led to understand that the best way to deploy a flask app on a bare
> machine is some WSGI wrapper server (like gunicorn for ex) with nginx in
> front as the proxy for virtual hosting / static files.  I am curious as to
> why there seems to be such a strong consensus about this and if anybody has
> had experience with alternative configurations.
>
> Right now, I have a staging environment set up using TwistedWeb.  The
> server is on a development machine and uses twisted VHostResource and
> WSGIResource to setup all the virtual hosts our developers need to see
> the latest commits they make live in their browsers.  I am hesitant to use
> this in any live environment since I put it together myself as a quick
> and dirty solution.  I'm not nearly familiar enough with the innards of
> Twisted to feel confident with how I handled redirects and static routing,
> etc.
>
> If one were to have multiple vhosts on a gunicorn (or any wrapper) 
/nginxconfiguration, would I need to have multiple WSGI wrapper instances 
running
> on different ports, one for each host, and have nginx proxy there?
>  Doesn't this considerably complicate deployment?
>
> Thanks for the help!
>