[Flask] Interchange data with main python application

Corey Boyle coreybrett at gmail.com
Mon May 23 17:34:24 EDT 2016


Have each independent app store events in a common queue. Each app also
watches for those events in the queue and processes them accordingly. Take
a look at http://python-rq.org .
On May 23, 2016 5:02 PM, "Nikolaus Neusser" <nik.gen at gmx.de> wrote:

> >For inter process communication, try using socket communication, either
> with straight sockets or via something like zeromq or similar.
>
> I think, that's the problem i have. Either way of inter process
> communication needs some kind of event loop.
> Flask runs its own event loop, right?
> So, how do i mix these two?
>
> Nik
>
>
> Am 20.05.2016 um 17:30 schrieb Anthony Ford:
>
> My suggestion is to avoid running either within the other. If possible,
> try running each standalone. For inter process communication, try using
> socket communication, either with straight sockets or via something like
> zeromq or similar.
>
> --Ford
> On May 20, 2016 10:12 AM, "Nikolaus Neusser" <nik.gen at gmx.de> wrote:
>
>> Hi everyone,
>>
>> I'm using flask for the first time and after trying quite a lot, i still
>> fail. :-(
>> I am wondering what i am doing wrong and if flask is the right way to go
>> at all.
>>
>> My objective:
>>    - I have a main python application, which basically is based on a
>> PySide (QT4) event loop.
>>      This runs a bigger state machine and several other functions.
>>    - Now, i want to add a web interface which reads/sets parameters and
>> displays a longer list of
>>      strings from the main application (variable length) .
>>
>> Where i am:
>>    - The simple flask examples from various tutorials work fine for me.
>>    - BUT: I cannot combine my main application with flask, i.e. i don't
>> know how to
>>      interchange the data between my main application and the flask
>> route-functions.
>>
>> What i tried:
>>    - running flask in a thread (QThread). Works fine for a simple
>> example, i.e. deliver static html
>>      and react on get-request
>>    - run flask in main thread. Doesn't work since some of my functions
>> rely on the qt event loop
>>    - interchanging data between my main application and flask in the
>> thread. I tried this using the
>>      qt signal/slot mechanism.
>>      This doesn't work, because the signals which i have to define in the
>> main application are not
>>      accessible within the flask route-functions.
>>
>>
>> I really hope you can give me some good advice.
>> I can post code snippets if it helps for clarification.
>>
>> Thanks a lot,
>>
>> Nik
>> _______________________________________________
>> 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/20160523/668a524e/attachment.html>


More information about the Flask mailing list