Answer the question
In order to leave comments, you need to log in
How to run flask on server?
Hey!
I'm trying to run an application on Ubuntu.
Initial data:
Created venv, installed flask there, uwsgi
mainapp.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'Bye Bye World!!!'
if __name__ == '__main__':
app.run()
from mainapp import app as application
if __name__ == "__main__":
application.run()
[Unit]
Description=uWSGI instance to serve fldk
After=network.target
[Service]
User=fldk
Group=fldk
WorkingDirectory=/home/fldk
Environment="PATH=/home/fldk/venv/bin"
ExecStart=/home/fldk/venv/bin/uwsgi --ini /home/fldk/venv/fldk.ini
[Install]
WantedBy=multi-user.target
[uwsgi]
module = wsgi:app
callable = app
master = true
processes = 5
virtualenv = /home/fldk/venv
socket = /home/fldk/venv/fldk.sock
chmod-socket = 666
vacuum = true
die-on-term = true
server {
listen 80;
server_name fldk.ru www.fldk.ru;
location / {
include uwsgi_params;
uwsgi_pass unix:/home/fldk/venv/fldk.sock;
}
location /static/ {
root /home/fldk/venv/;
}
}
Aug 15 12:14:05 elvis systemd[1]: Started uWSGI instance to serve fldk.
Aug 15 12:14:05 elvis uwsgi[22907]: [uWSGI] getting INI configuration from /home/fldk/venv/fldk.ini
Aug 15 12:14:05 elvis uwsgi[22907]: *** Starting uWSGI 2.0.18 (64bit) on [Thu Aug 15 12:14:05 2019] ***
Aug 15 12:14:05 elvis uwsgi[22907]: compiled with version: 5.4.0 20160609 on 14 August 2019 21:19:18
Aug 15 12:14:05 elvis uwsgi[22907]: os: Linux-2.6.32-042stab127.2 #1 SMP Thu Jan 4 16:41:44 MSK 2018
Aug 15 12:14:05 elvis uwsgi[22907]: nodename: elvis
Aug 15 12:14:05 elvis uwsgi[22907]: machine: x86_64
Aug 15 12:14:05 elvis uwsgi[22907]: clock source: unix
Aug 15 12:14:05 elvis uwsgi[22907]: detected number of CPU cores: 2
Aug 15 12:14:05 elvis uwsgi[22907]: current working directory: /home/fldk
Aug 15 12:14:05 elvis uwsgi[22907]: detected binary path: /home/fldk/venv/bin/uwsgi
Aug 15 12:14:05 elvis uwsgi[22907]: !!! no internal routing support, rebuild with pcre support !!!
Aug 15 12:14:05 elvis uwsgi[22907]: your processes number limit is 514625
Aug 15 12:14:05 elvis uwsgi[22907]: your memory page size is 4096 bytes
Aug 15 12:14:05 elvis uwsgi[22907]: detected max file descriptor number: 1024
Aug 15 12:14:05 elvis uwsgi[22907]: lock engine: pthread robust mutexes
Aug 15 12:14:05 elvis uwsgi[22907]: thunder lock: disabled (you can enable it with --thunder-lock)
Aug 15 12:14:05 elvis uwsgi[22907]: uwsgi socket 0 bound to UNIX address /home/fldk/venv/fldk.sock fd 3
Aug 15 12:14:05 elvis uwsgi[22907]: Python version: 3.7.3 (default, May 12 2019, 23:10:02) [GCC 5.4.0 20160609]
Aug 15 12:14:05 elvis uwsgi[22907]: PEP 405 virtualenv detected: /home/fldk/venv
Aug 15 12:14:05 elvis uwsgi[22907]: Set PythonHome to /home/fldk/venv
Aug 15 12:14:05 elvis uwsgi[22907]: *** Python threads support is disabled. You can enable it with --enable-threads ***
Aug 15 12:14:05 elvis uwsgi[22907]: Python main interpreter initialized at 0xbe1860
Aug 15 12:14:05 elvis uwsgi[22907]: your server socket listen backlog is limited to 100 connections
Aug 15 12:14:05 elvis uwsgi[22907]: your mercy for graceful operations on workers is 60 seconds
Aug 15 12:14:05 elvis uwsgi[22907]: mapped 437520 bytes (427 KB) for 5 cores
Aug 15 12:14:05 elvis uwsgi[22907]: *** Operational MODE: preforking ***
Aug 15 12:14:05 elvis uwsgi[22907]: ModuleNotFoundError: No module named 'wsgi'
Aug 15 12:14:05 elvis uwsgi[22907]: unable to load app 0 (mountpoint='') (callable not found or import error)
Aug 15 12:14:05 elvis uwsgi[22907]: *** no app loaded. going in full dynamic mode ***
Aug 15 12:14:05 elvis uwsgi[22907]: *** uWSGI is running in multiple interpreter mode ***
Aug 15 12:14:05 elvis uwsgi[22907]: spawned uWSGI master process (pid: 22907)
Aug 15 12:14:05 elvis uwsgi[22907]: spawned uWSGI worker 1 (pid: 22908, cores: 1)
Aug 15 12:14:05 elvis uwsgi[22907]: spawned uWSGI worker 2 (pid: 22909, cores: 1)
Aug 15 12:14:05 elvis uwsgi[22907]: spawned uWSGI worker 3 (pid: 22910, cores: 1)
Aug 15 12:14:05 elvis uwsgi[22907]: spawned uWSGI worker 4 (pid: 22911, cores: 1)
Aug 15 12:14:05 elvis uwsgi[22907]: spawned uWSGI worker 5 (pid: 22912, cores: 1)
python mainapp.py
или
python wsgi.py
ModuleNotFoundError: No module named 'wsgi'
unable to load app 0 (mountpoint='') (callable not found or import error)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question