Я развертываю приложение python flask в uWSGI. Я следовал этому уроку:
https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-14-04
Я не могу развернуть мое приложение на uwsgi.
Когда я выполняю вручную команду ff:
exec /app/myapp_be/myapp_be_env/bin/uwsgi --ini /app/myapp_be/myapp.ini
Это работает! Однако, если я пытаюсь запустить uwsgi.service (который содержится в / etc / systemd / system /) через «service uwsgi start», он возвращает ff:
«Запуск серверов приложений: uwsgi ->! Fail!»
Я попытался проверить логи в /var/log/uwsgi/app/myapp.log. вот что я вижу:
Mon Jan 7 01:33:48 2019 - detected number of CPU cores: 2
Mon Jan 7 01:33:48 2019 - current working directory: /
Mon Jan 7 01:33:48 2019 - writing pidfile to /run/uwsgi/app/myapp/pid
Mon Jan 7 01:33:48 2019 - detected binary path: /app/myapp_be/myapp_be_env
Mon Jan 7 01:33:48 2019 - chdir() to /app/myapp_be
Mon Jan 7 01:33:48 2019 - your processes number limit is 1048576
Mon Jan 7 01:33:48 2019 - your memory page size is 4096 bytes
Mon Jan 7 01:33:48 2019 - detected max file descriptor number: 1048576
Mon Jan 7 01:33:48 2019 - lock engine: pthread robust mutexes
Mon Jan 7 01:33:48 2019 - thunder lock: disabled (you can enable it with --thunder-lock)
Mon Jan 7 01:33:48 2019 - *** starting uWSGI Emperor ***
Mon Jan 7 01:33:48 2019 - uWSGI http bound on 0.0.0.0:5000 fd 3
Mon Jan 7 01:33:48 2019 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/myapp/socket fd 7
Mon Jan 7 01:33:48 2019 - setgid() to 33
Mon Jan 7 01:33:48 2019 - setuid() to 33
Mon Jan 7 01:33:48 2019 - your server socket listen backlog is limited to 100 connections
Mon Jan 7 01:33:48 2019 - your mercy for graceful operations on workers is 60 seconds
Mon Jan 7 01:33:48 2019 - mapped 436608 bytes (426 KB) for 5 cores
Mon Jan 7 01:33:48 2019 - *** Operational MODE: preforking ***
Mon Jan 7 01:33:48 2019 - *** no app loaded. going in full dynamic mode ***
Mon Jan 7 01:33:48 2019 - *** uWSGI is running in multiple interpreter mode ***
Mon Jan 7 01:33:48 2019 - spawned uWSGI master process (pid: 7746)
Вот мой myapp.ini:
[uwsgi]
binary-path = /app/myapp_be/myapp_be_env
virtualenv = /app/myapp_be/myapp_be_env
chdir = /app/myapp_be
module = main_backend_app
python-path = /app/myapp_be
workers = 4
callable = app
master = true
processes = 5
plugin = python27
http = 0.0.0.0:5000
chown-socket = www-data
chmod-socket = 777
vacuum = true
emperor = true
enable-threads = true
home = /app/myapp_be/myapp_be_env
die-on-term = true
Вот uwsgi.service:
[Unit]
Description=uWSGI instance to serve myapp
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=/app/myapp_be
ExecStart= /app/myapp_be/myapp_be_env/bin/uwsgi --ini /app/myapp_be/myapp.ini
[Install]
WantedBy=multi-user.target