gunicorn.service:无法确定用户凭据:没有这样的进程

gunicorn.service:无法确定用户凭据:没有这样的进程

我在尝试使用我的 django 项目设置 gunicorn 时不断收到错误

● gunicorn.service - gunicorn daemon
     Loaded: loaded (/etc/systemd/system/gunicorn.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2021-02-04 17:45:34 +01; 25min ago
TriggeredBy: ● gunicorn.socket
   Main PID: 754981 (code=exited, status=217/USER)

Feb 04 17:45:34 vps141106 systemd[1]: Started gunicorn daemon.
Feb 04 17:45:34 vps141106 systemd[754981]: gunicorn.service: Failed to determine user credentials: No such process
Feb 04 17:45:34 vps141106 systemd[754981]: gunicorn.service: Failed at step USER spawning /home/root/venv/bin/gunicorn: No such process
Feb 04 17:45:34 vps141106 systemd[1]: gunicorn.service: Main process exited, code=exited, status=217/USER
Feb 04 17:45:34 vps141106 systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Feb 04 17:45:34 vps141106 systemd[1]: gunicorn.service: Start request repeated too quickly.
Feb 04 17:45:34 vps141106 systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Feb 04 17:45:34 vps141106 systemd[1]: Failed to start gunicorn daemon.

这是我的服务

[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target

[Service]
User=root
Group=www-data
WorkingDirectory=/home/root/test
ExecStart=/home/root/venv/bin/gunicorn \
          --access-logfile - \
          --workers 3 \
          --bind unix:/run/gunicorn.sock \
          test.wsgi:application

[Install]
WantedBy=multi-user.target

我收到了这些错误

gunicorn.service: Failed to determine user credentials: No such process
gunicorn.service: Failed at step USER spawning /home/root/venv/bin/gunicorn: No such process

现在我很确定 /home/root/venv/bin/gunicorn 中有一些东西我刚刚做了

nano /home/root/venv/bin/gunicorn 并得到这个

  GNU nano 4.8                                           /home/root/venv/bin/gunicorn                                                     
#!/home/root/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from gunicorn.app.wsgiapp import run
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(run())

所以我已经安装了 gunicorn

现在出现第一个错误,我不确定是什么原因造成的,系统用户名为 root 并具有 sudo 权限

我希望你们能够帮助我。

相关内容