[Flask] Flask-Security =?utf-8?Q?can=E2=80=99t_?=work with Gunicorn with multiple workers

王帅 stamaimer at gmail.com
Tue Jan 10 02:46:09 EST 2017


Thanks for your reply.

I have no idea where to store the session. I have no configuration about session. Need i use Flask-Session?

On 10 Jan 2017, 2:42 PM +0800, Unai Rodriguez <unai at sysbible.org>, wrote:
> Hi 王帅,
>
> It seems that somehow your application is storing information that's only available to the Gunicorn instance that the client connects to.
>
> Have you tested forcing the same user connecting always to the same Gunicorn instance? That should probably work.
>
> Where are you storing the session information?
>
> -- unai
>
>
> On Tue, Jan 10, 2017, at 02:11 PM, 王帅 wrote:
> > Hello, everyone.
> >
> > I’m writing a website withFlask. I use Flask-Security to do authentication and use Nginx + Gunicorn to deploy it.
> >
> > And I find a problem that Flask-Security can’t work with Gunicorn with multiple workers.
> >
> > If the worker number is one, I can login normally. If the worker number of Gunicorn is greater than one or there is more than one Gunicorn servers behind Nginx, There are three situations will happen:
> >
> > 1. It will login normally;
> > 2. It will redirect to login page again;
> > 3. It will redirect to the page protected by Flask-Security with unlogined status.
> >
> > After I expose Gunicorn server to public, It remains.
> > _______________________________________________
> > Flask mailing list
> > Flask at python.org
> > https://mail.python.org/mailman/listinfo/flask
>
> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20170110/66af4f19/attachment-0001.html>


More information about the Flask mailing list