我正在使用 django,现在尝试使用 nginx 和 uwsi 配置服务器。现在我运行 nginx+socket+uwsgi_emperor 很好。为了运行 uwsgi 我在终端中使用以下命令:
/usr/local/bin/uwsgi --emperor /etc/uwsgi/vassals --uid www-data --gid www-data
Run Code Online (Sandbox Code Playgroud)
而且效果很好。现在我想添加服务,systemctl {start|stop|restart|status} uwsgi.service以便我可以轻松使用 uwsgi。这里出现问题。这里是/etc/systemd/system/uwsgi.service:
[Unit]
Description=uWSGI Emperor
After=syslog.target
[Service]
# i'm putting code same code of terminal exactly here:
ExecStart=/usr/local/bin/uwsgi --emperor /etc/uwsgi/vassals --uid www-data --gid www-data
# Requires systemd version 211 or newer
RuntimeDirectory=uwsgi
Restart=always
KillSignal=SIGQUIT
Type=notify
StandardError=syslog
NotifyAccess=all
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
现在,当我开始systemctl start uwsgi.service运行它时,我可以看到systemctl status uwsgi.servicethaat 已加载良好,但是当我想访问 ip 时,会出现错误,显示journalctl -b -u uwsgi我的 django 无法访问(读取)环境变量。因为我在 django …