无法启动 gunicorn.service:未找到单位 gunicorn.service。 Ubuntu 18.04
Failed to start gunicorn.service: Unit gunicorn.service not found. Ubunto 18.04
我正在关注 this 如何在 Ubuntu 18.04 指南中使用 Postgres、Nginx 和 Gunicorn 设置 Django。
我创建了以下文件.socket
sudo nano /etc/systemd/system/gunicorn.socket
[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/run/gunicorn.sock
[Install]
WantedBy=sockets.target
我创建了以下文件.service
sudo nano /etc/systemd/system/gunicorn.service
原文RECOMENDED_FORMATTING-s中guide
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=sammyRECOMENDED_FORMATTING
Group=www-data
WorkingDirectory=/home/sammyRECOMENDED_FORMATTING/myprojectdirRECOMENDED_FORMATTING
ExecStart=/home/sammyRECOMENDED_FORMATTING/myprojectdirRECOMENDED_FORMATTING/myprojectenvRECOMENDED_FORMATTING/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
myprojectRECOMENDED_FORMATTING.wsgi:application
[Install]
WantedBy=multi-user.target
我是如何格式化我自己的版本的我的虚拟环境在服务器上的项目文件夹之外
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=SERVER_USER
Group=www-data
WorkingDirectory=/home/SERVER_USER/MAIN_PROJECT_FOLDER
ExecStart=/home/SERVER_USER/ven/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/home/SERVER_USER/MAIN_PROJECT_FOLDER/MAINAPPLICATION_FOLDER.sock \
MAINAPPLICATION_FOLDER.wsgi:application
[Install]
WantedBy=multi-user.target
我也试过按照最初的建议保留这些
--bind unix:/run/gunicorn.sock \
我试过执行下面的代码
sudo systemctl start gunicorn
错误信息 1
Failed to start gunicorn.service: Unit gunicorn.service not found.
我也试过 2
sudo systemctl start gunicorn.socket
错误信息 2
Failed to start gunicorn.socket: Unit gunicorn.socket is not loaded properly: Invalid argument.
See system logs and 'systemctl status gunicorn.socket' for details.
为了解决这个问题,我试过了
- Failed to start gunicorn.service: Unit gunicorn.service not found 这指向与我正在做的完全相同的指南,除了 linux.
的旧版本
- 这不是同一个代码,没有回答https://askubuntu.com/questions/748836/unit-gunicorn-service-failed-to-load-no-such-file-or-directory
- 运行:
systemctl status gunicorn.socket
结果: Warning: The unit file, source configuration file or drop-ins of gunicorn.socket changed on disk
● gunicorn.socket - gunicorn daemon
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
- 运行:
systemctl is-enabled gunicorn.socket
结果: enabled
- 运行:
systemctl is-enabled gunicorn.service
结果: Failed to get unit file state for gunicorn.service: No such file or directory
已修复:
sudo systemctl enable gunicorn.service
我花了大约三个小时... Fxxx
不要这样做:
sudo systemctl start gunicorn.socket
sudo systemctl enable gunicorn.socket
这样做:
sudo systemctl enable gunicorn.socket
sudo systemctl start gunicorn.socket
和:
sudo systemctl status gunicorn.socket
现在可以正常使用了 !
我正在关注 this 如何在 Ubuntu 18.04 指南中使用 Postgres、Nginx 和 Gunicorn 设置 Django。
我创建了以下文件.socket
sudo nano /etc/systemd/system/gunicorn.socket
[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/run/gunicorn.sock
[Install]
WantedBy=sockets.target
我创建了以下文件.service
sudo nano /etc/systemd/system/gunicorn.service
原文RECOMENDED_FORMATTING-s中guide
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=sammyRECOMENDED_FORMATTING
Group=www-data
WorkingDirectory=/home/sammyRECOMENDED_FORMATTING/myprojectdirRECOMENDED_FORMATTING
ExecStart=/home/sammyRECOMENDED_FORMATTING/myprojectdirRECOMENDED_FORMATTING/myprojectenvRECOMENDED_FORMATTING/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
myprojectRECOMENDED_FORMATTING.wsgi:application
[Install]
WantedBy=multi-user.target
我是如何格式化我自己的版本的我的虚拟环境在服务器上的项目文件夹之外
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=SERVER_USER
Group=www-data
WorkingDirectory=/home/SERVER_USER/MAIN_PROJECT_FOLDER
ExecStart=/home/SERVER_USER/ven/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/home/SERVER_USER/MAIN_PROJECT_FOLDER/MAINAPPLICATION_FOLDER.sock \
MAINAPPLICATION_FOLDER.wsgi:application
[Install]
WantedBy=multi-user.target
我也试过按照最初的建议保留这些
--bind unix:/run/gunicorn.sock \
我试过执行下面的代码
sudo systemctl start gunicorn
错误信息 1
Failed to start gunicorn.service: Unit gunicorn.service not found.
我也试过 2
sudo systemctl start gunicorn.socket
错误信息 2
Failed to start gunicorn.socket: Unit gunicorn.socket is not loaded properly: Invalid argument.
See system logs and 'systemctl status gunicorn.socket' for details.
为了解决这个问题,我试过了
- Failed to start gunicorn.service: Unit gunicorn.service not found 这指向与我正在做的完全相同的指南,除了 linux. 的旧版本
- 这不是同一个代码,没有回答https://askubuntu.com/questions/748836/unit-gunicorn-service-failed-to-load-no-such-file-or-directory
- 运行:
systemctl status gunicorn.socket
结果:Warning: The unit file, source configuration file or drop-ins of gunicorn.socket changed on disk ● gunicorn.socket - gunicorn daemon Loaded: error (Reason: Invalid argument) Active: inactive (dead)
- 运行:
systemctl is-enabled gunicorn.socket
结果:enabled
- 运行:
systemctl is-enabled gunicorn.service
结果:Failed to get unit file state for gunicorn.service: No such file or directory
已修复:
sudo systemctl enable gunicorn.service
我花了大约三个小时... Fxxx
不要这样做:
sudo systemctl start gunicorn.socket
sudo systemctl enable gunicorn.socket
这样做:
sudo systemctl enable gunicorn.socket
sudo systemctl start gunicorn.socket
和:
sudo systemctl status gunicorn.socket
现在可以正常使用了 !