uWISGI with Qt for Python

Thomas Jollans tjol at tjol.eu
Thu Mar 14 04:23:38 EDT 2019


On 13/03/2019 22:42, Israel Brewster wrote:
> 1) Is there a “better way”? This GitHub repo: https://github.com/unbit/uwsgi-qtloop seems to indicate that it should be possible to run a Qt event loop from within a uWSGI app, thus eliminating the extra “subprocess” spinoff, but it hasn’t been updated in 5 years and I have been unable to get it to work with my current Qt/Python/OS setup
> 
> 2) Baring any “better way”, is there a way to at least ensure that the subprocess is killed in the event of parent death, or alternately to look for and kill any such lingering processes on application startup?
> 
> P.S. The purpose of running the web server is to be able to load and use Plotly charts in my app (via a QWebEngineView). So a “better way” may be using a different plotting library that can essentially “cut out” the middle man. I’ve tried Matplotlib, but I found its performance to be worse than Plotly - given the size of my data sets, performance matters. Also I had some glitches with it when using a lasso selector (plot going black). Still, with some work, it may be an option.

In a similar situation (web component in a Qt app) we simply use
werkzeug's built-in web server in a Python/Qt thread. This works very
nicely, but the performance probably isn't perfect. Our use case is
allowing a small part of our experiments to be controlled from a phone
in the local network, so the performance requirements aren't severe at all.

As for live plotting in a GUI app, you're right, matplotlib isn't really
suitable. But pyQtgraph is: http://www.pyqtgraph.org/
I've had no problems with it at all for streaming live measurement data
to screen and interacting with reasonable-sized 2d images. I expect
that's your best option.

Despite what the description says, it does PyQt5 as well as PyQt4.

Best,
- Thomas



More information about the Python-list mailing list