我遵循了[DigitalOcean指南]((https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-debian-10)来设置我的Django网站。它通常可以正常工作,但最近我一直遇到这个问题。
root@localhost:/usr/bin# sudo systemctl status gunicorn
Jun 13 21:27:43 localhost systemd[1]: Started gunicorn daemon.
Jun 13 21:27:43 localhost gunicorn[20611]: Traceback (most recent call last):
Jun 13 21:27:43 localhost gunicorn[20611]: File "/usr/bin/gunicorn", line 6, in <module>
Jun 13 21:27:43 localhost gunicorn[20611]: from gunicorn.app.wsgiapp import run
Jun 13 21:27:43 localhost gunicorn[20611]: ModuleNotFoundError: No module named 'gunicorn'
Jun 13 21:27:43 localhost systemd[1]: gunicorn.service: Main process exited, code=exited, status=1/FAILURE
Jun 13 21:27:43 localhost systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Jun 13 21:27:43 localhost systemd[1]: gunicorn.service: Start request repeated too quickly.
Jun 13 21:27:43 localhost systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Jun 13 21:27:43 localhost systemd[1]: Failed to start gunicorn daemon.
root@localhost:/home/development/django# which gunicorn
/usr/bin/gunicorn
/etc/systemd/system/gunicorn.service
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=/home/development/django/
ExecStart=/usr/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
app.wsgi:application
[Install]
WantedBy=multi-user.target