Re: [flask] Flask, WSGI, and Async servers: Clarification needed.
- From:
- Ryan Cole
- Date:
- 2010-09-14 @ 01:29
I also deploy using Gunicorn. I use the gevent workers.
Ryan
On Mon, Sep 13, 2010 at 4:34 PM, Peter Ward <peteraward@gmail.com> wrote:
> I've been using gunicorn to deploy flask, and while I don't have a large
> user base,
> I've never seen any concurrency problems.
> No idea about uWSGI.
>
> On Tue, Sep 14, 2010 at 2:34 AM, Tim Miller <tim@lashni.net> wrote:
>
>> On 14/09/10 02:25, kevin beckford wrote:
>> > Ok: I am rereading the docs, and came upon this:
>> >
>> > "There is only one limiting factor regarding scaling in Flask which
>> > are the context local proxies. They depend on context which in Flask
>> > is defined as being either a thread, process or greenlet. If your
>> > server uses some kind of concurrency that is not based on threads or
>> > greenlets, "
>> >
>> > I was planning on using gunicorn, or uwsgi to serve flask. I know
>> > Tornado is out. I just need to be sure that gunicorn and uwsgi are
>> > in.
>> >
>> > Do these servers function correctly, or rather, will flask function
>> > correctly in those environments?
>> >
>>
>> Gunicorn uses greenlets for its async workers (gevent or eventlet) so
>> going by the description above I presume it would be fine. I'd be
>> interested to hear how it goes if you get around to testing.
>>
>> http://flask.pocoo.org/docs/deploying/others/
>>
>
>
>
> --
> Peter Ward
> http://flowblok.id.au/
>
Re: [flask] Flask, WSGI, and Async servers: Clarification needed.
- From:
- kevin beckford
- Date:
- 2010-09-14 @ 05:13
Thank you all very much. That's what I needed to hear.
Re: [flask] Flask, WSGI, and Async servers: Clarification needed.
- From:
- bruce bushby
- Date:
- 2010-09-14 @ 12:26
I use gunicorn....only funny I found is that I had to change my app a
little. I had to strip main.py and move the flask init etc into
a server.py and then point gunicorn to server.py ... rather then pointing
gunicorn to main:app
....but I am a complete novice so perhaps I'm doing it wrong :)
On Tue, Sep 14, 2010 at 6:13 AM, kevin beckford <chiggsy@lazyweb.ca> wrote:
> Thank you all very much. That's what I needed to hear.
>
Re: [flask] Flask, WSGI, and Async servers: Clarification needed.
- From:
- Peter Ward
- Date:
- 2010-09-14 @ 12:33
@Bruce:
is it because you had something like this in main.py:
from flask import Flask
app = Flask(__name__)
...
app.run()
If so, you can fix this so that the app.run() call only happens if you call
"python main.py", as opposed to being imported by something like gunicorn:
...
if __name__ == '__main__':
app.run()
Having said that, if it works, it works! :)
On Tue, Sep 14, 2010 at 10:26 PM, bruce bushby
<bruce.bushby@googlemail.com>wrote:
>
> I use gunicorn....only funny I found is that I had to change my app a
> little. I had to strip main.py and move the flask init etc into
> a server.py and then point gunicorn to server.py ... rather then pointing
> gunicorn to main:app
>
> ....but I am a complete novice so perhaps I'm doing it wrong :)
>
>
> On Tue, Sep 14, 2010 at 6:13 AM, kevin beckford <chiggsy@lazyweb.ca>wrote:
>
>> Thank you all very much. That's what I needed to hear.
>>
>
>
--
Peter Ward
http://flowblok.id.au/
Re: [flask] Flask, WSGI, and Async servers: Clarification needed.
- From:
- bruce bushby
- Date:
- 2010-09-14 @ 12:39
Thanks Peter!!
This was my main:
http://github.com/BruceUK/myapp/blob/master/myapp/main.py
<http://github.com/BruceUK/myapp/blob/master/myapp/main.py>I thought the "if
__name__ .." would take care of the fact that it's now a module.
whilst sitting inside the same directory as that "main.py" file, I tried
running:
"gunicorn main:app"
I'll try stripping out the "if__name__" etc all together and see how it
goes.
On Tue, Sep 14, 2010 at 1:33 PM, Peter Ward <peteraward@gmail.com> wrote:
> @Bruce:
> is it because you had something like this in main.py:
> from flask import Flask
> app = Flask(__name__)
> ...
> app.run()
>
> If so, you can fix this so that the app.run() call only happens if you call
> "python main.py", as opposed to being imported by something like gunicorn:
> ...
> if __name__ == '__main__':
> app.run()
>
> Having said that, if it works, it works! :)
>
> On Tue, Sep 14, 2010 at 10:26 PM, bruce bushby <
> bruce.bushby@googlemail.com> wrote:
>
>>
>> I use gunicorn....only funny I found is that I had to change my app a
>> little. I had to strip main.py and move the flask init etc into
>> a server.py and then point gunicorn to server.py ... rather then pointing
>> gunicorn to main:app
>>
>> ....but I am a complete novice so perhaps I'm doing it wrong :)
>>
>>
>> On Tue, Sep 14, 2010 at 6:13 AM, kevin beckford <chiggsy@lazyweb.ca>wrote:
>>
>>> Thank you all very much. That's what I needed to hear.
>>>
>>
>>
>
>
> --
> Peter Ward
> http://flowblok.id.au/
>