Difference between revisions of "Flask from command line"

From ProgZoo
Jump to navigation Jump to search
Line 12: Line 12:
Your service will be more reliable if you run using uwsgi:
Your service will be more reliable if you run using uwsgi:
Install <code>uwsgi</code> and <code>uwsgi-plugin-python3</code>
Install <code>uwsgi</code> and <code>uwsgi-plugin-python3</code>
 
sudo apt install uwsgi uwsgi-plugin-python3
Change <code>/etc/nginx/sites-enabled/tmp.progzoo.net</code> to
Change <code>/etc/nginx/sites-enabled/tmp.progzoo.net</code> to
  server {
  server {

Revision as of 23:03, 18 September 2021

Windows: Install python and flask, run the first program

Get python flask going on windows:

Linux: Install flask, tunnel into debug version

Get python flask going on a remote linux server:

Linux: Running flask for production under uwsgi

Your service will be more reliable if you run using uwsgi: Install uwsgi and uwsgi-plugin-python3

sudo apt install uwsgi uwsgi-plugin-python3

Change /etc/nginx/sites-enabled/tmp.progzoo.net to

server {
  server_name tmp.progzoo.net;
  location / {
    include uwsgi_params;
    uwsgi_pass unix:/tmp/project1.sock;
  }
  location /static {
    alias /home/andrew/project1/static;
  }
}

Create the file /etc/uwsgi/apps-enabled/tmp.ini

[uwsgi]
plugins = python3
pythonpath = /home/andrew/project1/venv/bin
module = wsgi
socket = /tmp/project1.sock
chmod-socket = 775
chdir = /home/andrew/project1
virtualenv = venv
master = true
module = server:app