[Flask] Interchange data with main python application

Nikolaus Neusser nik.gen at gmx.de
Fri May 20 11:11:46 EDT 2016


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


More information about the Flask mailing list