Thursday, March 1, 2018

Add Twistd to your Flask app

I'm using twisted web as front end for flask wsgi app. you probably already know of it. if not, it's essential. non-blocking IO. fully scales up.


1000's of connections

essentially, twisted combines the non-blocking IO of tornado and front end container of gunicorn in one package

$ pip install twisted

$ vi run.sh
export PYTHONPATH=.:$PYTHONPATH
twistd -n web --port tcp:8006 --wsgi yourfile.app

<where .app is the flask app inside yourfile.py>

$ nohup ./run.sh &



No comments:

Post a Comment