-
Notifications
You must be signed in to change notification settings - Fork 4
Setup front end with plotly dash, flask, gunicorn and nginx
Pan Deng edited this page May 23, 2018
·
2 revisions
Refer to instructions at: https://github.com/InsightDataScience/data-engineering-ecosystem/wiki/Flask
dash
and components can be downloaded via pip
.
To connect dash
to flask
:
# Define for IIS module registration.
wsgi_app = app.wsgi_app
# Connect dash to flask
dashapp = dash.Dash(__name__, server=app, url_base_pathname='/')
Buy a domain at namecheap.com
Follow the instructions here: http://techgenix.com/namecheap-aws-ec2-linux/ Create host zones and add the servers to domain's custom DNS
sudo apt-get install nginx
conda install gunicorn
sudo /etc/init.d/nginx
sudo rm /etc/nginx/sites-enabled/default
sudo touch /etc/nginx/sites-available/application
sudo ln -s /etc/nginx/sites-available/application /etc/nginx/sites-enabled/application
sudo nano /etc/nginx/sites-enabled/application
And paste (exactly):
server {
location / {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Finally, run
gunicorn foldername:appvariablename
outside the folder. (Appvariablename: Flask(__name__)
)
In this case:
GeneMiner/flask-dash-app $ gunicorn app:app
To run in the background:
GeneMiner/flask-dash-app $ gunicorn app:app -D
Kill the process:
pkill gunicorn