我正在关注这Askbot 安装教程,一切顺利,直到最后,我无法使用以下命令启动 uWsgi:
sudo systemctl restart uwsgi
我收到的错误是:
sudo systemctl restart uwsgi
Job for uwsgi.service failed because the control process exited with error code.
See "systemctl status uwsgi.service" and "journalctl -xe" for details.
ubuntu@ip-XX-XX-XX-XX:~$ systemctl status uwsgi.service
● uwsgi.service - LSB: Start/stop uWSGI server instance(s)
Loaded: loaded (/etc/init.d/uwsgi; generated)
Active: failed (Result: exit-code) since Fri 2018-11-30 12:15:45 UTC; 44s ago
Docs: man:systemd-sysv-generator(8)
Process: 19678 ExecStop=/etc/init.d/uwsgi stop (code=exited, status=0/SUCCESS)
Process: 7999 ExecStart=/etc/init.d/uwsgi start (code=exited, status=1/FAILURE)
Nov 30 12:15:45 ip-XX-XX-XX-XX systemd[1]: Starting LSB: Start/stop uWSGI server instance(s)...
Nov 30 12:15:45 ip-XX-XX-XX-XX uwsgi[7999]: * Starting app server(s) uwsgi
Nov 30 12:15:45 ip-XX-XX-XX-XX uwsgi[7999]: ...fail!
Nov 30 12:15:45 ip-XX-XX-XX-XX systemd[1]: uwsgi.service: Control process exited, code=exited status=1
Nov 30 12:15:45 ip-XX-XX-XX-XX systemd[1]: uwsgi.service: Failed with result 'exit-code'.
Nov 30 12:15:45 ip-XX-XX-XX-XX systemd[1]: Failed to start LSB: Start/stop uWSGI server instance(s).
ubuntu@ip-XX-XX-XX-XX:~$ journalctl -xe
-- Subject: Unit uwsgi.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit uwsgi.service has begun starting up.
Nov 30 12:22:53 ip-XX-XX-XX-XX uwsgi[9701]: * Starting app server(s) uwsgi
Nov 30 12:22:53 ip-XX-XX-XX-XX uwsgi[9701]: ...fail!
Nov 30 12:22:53 ip-XX-XX-XX-XX systemd[1]: uwsgi.service: Control process exited, code=exited status=1
Nov 30 12:22:53 ip-XX-XX-XX-XX systemd[1]: uwsgi.service: Failed with result 'exit-code'.
Nov 30 12:22:53 ip-XX-XX-XX-XX systemd[1]: Failed to start LSB: Start/stop uWSGI server instance(s).
-- Subject: Unit uwsgi.service has failed
(venv) askbot@ip-XX-XX-XX-XX:/srv/askbot/venv$ sudo /etc/init.d/uwsgi status
● uwsgi.service - LSB: Start/stop uWSGI server instance(s)
Loaded: loaded (/etc/init.d/uwsgi; generated)
Active: failed (Result: exit-code) since Fri 2018-11-30 12:41:10 UTC; 26s ago
Docs: man:systemd-sysv-generator(8)
Process: 19678 ExecStop=/etc/init.d/uwsgi stop (code=exited, status=0/SUCCESS)
Process: 12812 ExecStart=/etc/init.d/uwsgi start (code=exited, status=1/FAILURE)
Nov 30 12:41:10 ip-XX-XX-XX-XX systemd[1]: Starting LSB: Start/stop uWSGI server instance(s)...
Nov 30 12:41:10 ip-XX-XX-XX-XX uwsgi[12812]: * Starting app server(s) uwsgi
Nov 30 12:41:10 ip-XX-XX-XX-XX uwsgi[12812]: ...fail!
Nov 30 12:41:10 ip-XX-XX-XX-XX systemd[1]: uwsgi.service: Control process exited, code=exited status=1
Nov 30 12:41:10 ip-XX-XX-XX-XX systemd[1]: uwsgi.service: Failed with result 'exit-code'.
Nov 30 12:41:10 ip-XX-XX-XX-XX systemd[1]: Failed to start LSB: Start/stop uWSGI server instance(s).
(venv) askbot@ip-XX-XX-XX-XX:/srv/askbot/venv$
答案1
/var/log/uwsgi.log 中的日志文件显示我缺少“/srv/askbot/venv/askbot-app”目录,因为教程中根本没有提到它。创建它之后,我就可以启动 uWsgi 了。