[Flask] errors w/ flask deployment with emperor
tigernassau
tigernassau at gmail.com
Tue Oct 20 20:34:30 CEST 2015
okay, we took another try at getting flask to deploy using emperor
server: debian 8, using python3
server runs bottle apps fine
here is the config we tried - get error: "curse the vassal...
/etc/uwsgi/vassals/testapp.ini
couldn't find any more details on what is wrong
btw had to run uwsgi emperor as sudo since the systemd service failed
with log file permission error
---- w/ flask ---
# sudo apt-get install python3-dev
# sudo apt-get install python3-pip
# sudo pip3 install flask
# sudo pip3 install py-bcrypt
# sudo pip3 install psycopg2
# sudo pip3 install uwsgi
# sudo apt-get install uwsgi-plugin-python
sudo vim /etc/nginx/nginx.conf
user nginx;
worker processes 5
.....
http {
...
server {
listen 80;
server_name testapp.com www.testapp.com;
root /home/testapp;
charset utf-8;
location /static {
alias /home/testapp/static;
}
location = /favico.ico {
root /home/testapp/static/images/favico.ico;
}
location / {
try_files $uri @wsgi;
}
location @wsgi {
include /etc/nginx/uwsgi_params;
uwsgi_pass unix:/home/testapp/testapp.sock;
}
}
} #http
sudo service nginx configtest
sudo service nginx start (stop reload)
---- uwsgi-emperor ---
sudo vim /etc/uwsgi/emperor.ini
[uwsgi]
emperor = /etc/uwsgi/vassals
master = true
#plugins = python2
#uid = www-data
#gid = www-data
--- uwsgi vassals ---
sudo vim /etc/uwsgi/vassals/testapp.ini
[uwsgi]
chdir = /home/testapp
socket = /home/testapp/testapp.sock
chmod-socket = 664
file = app.py
callable = app
processes = 4
stats = 127.0.0.1:9191
max-requests = 5000
#master = true
#plugins = python
#uid = www-data
#gid = www-data
vacuum = true
thunder-lock = true
enable-threads = true
logto = /var/log/uwsgi/testapp.log
# die-on-term = true
---- systemd service emperor ---
sudo vim /etc/systemd/system/testapp.service
[Unit]
Description=uwsgi emperor for testapp
After=network.target
[Service]
User=www-data
Group=www-data
WorkingDirectory=/home/testapp
ExecStart=uwsgi --emperor /etc/uwsgi/vassals/testapp.ini --logto
/var/log/uwsgi/testapp.log
#[Install]
#WantedBy=multi-user.target
--
Tiger Nassau, Inc.
www.tigernassau.com
More information about the Flask
mailing list