Hi, For a work project I'm building Python software that runs inside a rather limited environment. An upstream software supplier provides software that spawns a Python environment where I need to execute code that is not thread-safe. The upstream supplier did add some mechanics to allow thread safety, but it requires me to call some custom code from each newly spawned thread.
The actual functionality that I need to run in the environment is a small Flask app. When running this app using the Flask builtin dev server, it only works when I disable threads using: flask_app.run(threaded=False). Now I wanted to not use the Flask dev server but something a little more sophisticated. Enter waitress: it runs on Windows (hard requirement), it's simple and it can serve my Flask app directly from Python (no external servers like apache+mod_wsgi required). There is only a single client sending requests to the server, so performance/concurrency is not a requirement. However, I cannot get waitress to run as a single thread. Settings threads=1 doesn't help (it's probably the master process + 1 task thread). I found a SO post [1] that suggests two options, but both don't work: setting the parameter "threaded" to False, but this parameter doesn't exist (in waitress 3.0.2), and setting "connection_limit" to 1, which renders the app unreachable. Running threaded would probably mean that I subclass the ThreadedTaskDispatcher to add the specific code from the supplier. Another option would be to create a non-threading Dispatcher myself from scratch, and use that. All that seems way too complicated. Do you have advice for me? Can I even run waitress without threads? Where did the "threaded" parameter to the serve() function go, if it ever existed? Should I be looking at a different Python-only app server that I somehow didn't find in my searches, and works on Windows? Should I even bother and just use the Flask dev server? [1] https://stackoverflow.com/a/78515009/2991260 Thanks for all knowledge you might be able to share Kind regards, Tom -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/pylons-discuss/e061f9fe-955e-445e-a825-54469f1c2184n%40googlegroups.com.
