The built-in werkzeug server certainly is not suitable for running production servers. The most obvious reason is the fact that the werkzeug server is single-threaded and thus can only handle one request at a time.
Because of this we want to use the uWSGI Server to serve our application instead. In...
Now we want to install nginx to serve our application.
sudo apt-get install nginx # on debian/ubuntu
Then we create a configuration for our website
cd /etc/nginx/site-available # go to the configuration for available sites
# create a file flaskconfig with your favourite editor
flaskconfig...
Flask has that feature which lets you stream data from a view by using generators.
Let's change the app.py file
add from flask import Response
add from datetime import datetime
add from time import sleep
create a new view:
@app.route("/time/")
def time():
def streamer():
...
This is a porting of set up sourced from DigitalOcean's tutorial of How To Serve Flask Applications with uWSGI and Nginx on Ubuntu 14.04
and some useful git resources for nginx servers.
Flask Application
This tutorial assume you use Ubuntu.
locate var/www/ folder.
Create your web app folder m...