首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >设置gunicorn以运行systemd

设置gunicorn以运行systemd
EN

Stack Overflow用户
提问于 2017-06-29 07:05:20
回答 1查看 11.9K关注 0票数 4

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

代码语言:javascript
复制
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而导致的在gunicorn服务的第9行中开始的错误。

代码语言:javascript
复制
[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
EN

回答 1

Stack Overflow用户

发布于 2017-06-29 16:17:46

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

Executable path is not absolute, ignoring

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

  • 系统的可执行文件:ExecStart=/usr/local/bin/gunicorn
  • 您的虚拟环境的可执行文件:ExecStart=/path/to/venv/bin/gunicorn

您可以查看下面的gist:使用Systemd确保Gunicorn启动,以获得一个最小的gunicorn systemd服务配置文件。

希望这能有所帮助!

票数 12
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44818451

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档