-
Notifications
You must be signed in to change notification settings - Fork 23
Description
this is single thread and slow
$ python3 app.py
By doing python3 app.py you running api server in single thread with development server, which is highly not recommendation for production
Volbil, [08.02.20 11:03]
There is couple ways to do that, I'm personally using gunicorn and systemd
Volbil, [08.02.20 11:33]
Well, it's not a python but flask server
Volbil, [08.02.20 11:33]
Framework which I'm using
Volbil, [08.02.20 11:39]
Also debug server is bad for production
Volbil, [08.02.20 11:39]
Since it can expose some debug consoles and etc
Volbil, [08.02.20 11:39]
[Forwarded from Fork]
pip3 install gunicorn
pip3 install eventlet
gunicorn app:app --worker-class eventlet -w 1 --bind 0.0.0.0:5000 --reload
Volbil, [08.02.20 11:39]
[In reply to Volbil]
[Unit]
Description=uWSGI instance to serve sugar api
After=network.target
[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/api
Environment="PATH=/home/ubuntu/api/venv/bin"
ExecStart=/home/ubuntu/api/venv/bin/gunicorn app:app --worker-class eventlet -w 1 --bind 0.0.0.0:5000 --reload
[Install]
WantedBy=multi-user.target
Volbil, [08.02.20 11:39]
[In reply to Volbil]
Systemd config
https://blog.fossasia.org/setting-up-nginx-gunicorn-and-flask-socketio/