Tornado's WSGIContainer is a single-threaded WSGI server and rarely makes sense to use on its own. Unless you have a specific reason for combining a WSGI app and a Tornado app in the same process, you'll be better off using a dedicated multi-threaded WSGI server like gunicorn or uwsgi.
Running Fabric Commands in Flask Blocks Requests
-
15-10-2022 - |
Question
I'm currently running a Flask
server that import commands from a fabfile.py
and runs them using:
with settings(...):
command()
However, when someone is running a command, fabric
does not respond to other requests going to the flask
server until the command has finished. How can I make sure this does not happen?
I'm using tornado
to serve Flask
with the following settings:
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from flask_ import app
import tornado.options
tornado.options.parse_command_line()
http_server = HTTPServer(WSGIContainer(app))
http_server.listen(5000)
IOLoop.instance().start()
Thanks, Matt
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow