无法启动uwsgi服务

时间:2019-01-07 01:47:50

标签: python flask uwsgi systemd

我正在uWSGI中部署python flask应用程序。我遵循了本教程: 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

它确实有效!但是,如果我尝试通过“ service uwsgi start”启动uwsgi.service(包含在/ etc / systemd / system /中),它将返回ff:

“正在启动应用服务器:uwsgi->!失败!”

我尝试检查/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

0 个答案:

没有答案