Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django 将gunicorn设置为与systemd一起运行_Django_Gunicorn_Digital Ocean - Fatal编程技术网

Django 将gunicorn设置为与systemd一起运行

Django 将gunicorn设置为与systemd一起运行,django,gunicorn,digital-ocean,Django,Gunicorn,Digital Ocean,试图将gunicorn设置为与systemd一起运行。控制文件为/etc/systemd/system/gunicorn.service,测试输出为 root@samuel-pc:~# systemctl start gunicorn Failed to start gunicorn.service: Unit gunicorn.service is not loaded properly: Invalid argument. See system logs and 'systemctl sta

试图将
gunicorn
设置为与
systemd
一起运行。控制文件为
/etc/systemd/system/gunicorn.service
,测试输出为

root@samuel-pc:~# systemctl start gunicorn
Failed to start gunicorn.service: Unit gunicorn.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status gunicorn.service' for details.


root@samuel-pc:~# systemctl status gunicorn.service
● gunicorn.service - gunicorn daemon
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead)

Jun 29 05:13:17 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 05:13:17 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 29 05:13:29 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 05:13:29 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 29 05:15:45 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 05:15:45 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 29 07:01:10 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 07:01:10 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 29 07:01:55 samuel-pc systemd[1]: [/etc/systemd/system/gunicorn.service:9] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp
Jun 29 07:01:55 samuel-pc systemd[1]: gunicorn.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
它显示了由于
ExecStart

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

[Service]
User=root
Group=www-data
WorkingDirectory=/root/revamp
ExecStart=gunicorn --access-logfile - --workers 3 --bind unix:/root/revamp/revamp.sock revamp.wsgi:application


[Install]
WantedBy=multi-user.target

它告诉您它不需要
gunicorn
可执行文件的相对路径:
可执行路径不是绝对路径,忽略

您需要将其更改为
gunicorn
可执行文件的绝对路径,或者:

  • 系统的可执行文件:
    ExecStart=/usr/local/bin/gunicorn
  • 虚拟环境的可执行文件:
    ExecStart=/path/to/venv/bin/gunicorn
您可以查看以下要点:,以获取最小的gunicorn systemd服务配置文件


希望这有帮助

谢谢,我相信这解决了这个问题,现在我得到了一个
多余的参数
错误,你能发布日志吗?