未由 systemctl 启动 uwsgi

未由 systemctl 启动 uwsgi

我无法通过 systemctl 启动 uwsgi。

我的错误日志在下面。

$sudo systemctl status uwsgi.service
● uwsgi.service - uWSGI
   Loaded: loaded (/etc/systemd/system/uwsgi.service; enabled; vendor preset: enabled)
   Active: failed (Result: protocol) since Thu 2020-04-23 03:13:02 JST; 6s ago
 Main PID: 24676 (code=exited, status=0/SUCCESS)
   Status: "initializing uWSGI"

Apr 23 03:13:02 ip-172-17-1-78 systemd[1]: uwsgi.service: Service hold-off time over, scheduling restart.
Apr 23 03:13:02 ip-172-17-1-78 systemd[1]: uwsgi.service: Scheduled restart job, restart counter is at 5.
Apr 23 03:13:02 ip-172-17-1-78 systemd[1]: Stopped uWSGI.
Apr 23 03:13:02 ip-172-17-1-78 systemd[1]: uwsgi.service: Start request repeated too quickly.
Apr 23 03:13:02 ip-172-17-1-78 systemd[1]: uwsgi.service: Failed with result 'protocol'.
Apr 23 03:13:02 ip-172-17-1-78 systemd[1]: Failed to start uWSGI.

我用谷歌搜索了一下,发现这个错误可能与 anaconda 有关。

uwsgi在conda环境下使用。 /home/ubuntu/anaconda3/envs/py37/bin/uwsgi

uwsgi.service

[Unit]
Description = uWSGI
After = syslog.target

[Service]
ExecStart = /home/ubuntu/anaconda3/envs/py37/bin/uwsgi --ini /var/www/html/myapp/uwsgi.ini
Restart=always
KillSignal=SIGQUIT
Type=notify
StandardError=syslog
NotifyAccess=all

[Install]
WantedBy=multi-user.target

我使用命令行/home/ubuntu/anaconda3/envs/py37/bin/uwsgi --ini /var/www/html/myapp/uwsgi.ini

有用。

但是我该如何解决这个问题?

uwsgi.ini的在下面

[uwsgi]
chdir=/var/www/html/myapp/current
module=myapp.wsgi
env DJANGO_SETTINGS_MODULE=myapp.settings
http = 0.0.0.0:8008
processes = 4
threads = 1
master = 1
max-requests = 100
max-requests-delta = 5
pythonpath = /home/ubuntu/anaconda3/envs/py37/lib/python3.7/site-packages
pythonhome = /home/ubuntu/anaconda3/envs/py37/bin
harakiri = 280
daemonize = /var/log/uwsgi.log
log-reopen = true
log-maxsize = 8000000
logfile-chown = on
logfile-chmod = 644 
pidfile = /var/run/uwsgi/uwsgi.pid
stats = /var/run/uWSGI/projectname.stats.sock
memory-report = true

答案1

更新:

Type=notify

Type=Forking

相关内容