sudo systemctl status gunicorn 실행 시 ModuleNotFoundError 오류 발생

sudo systemctl status gunicorn 실행 시 ModuleNotFoundError 오류 발생

Ubuntu 서버에 Django 프로젝트를 배포하려고 합니다. 나는 이것을 따르고 있다가이드.

하지만 이 명령을 실행할 때 문제가 발생하고 sudo systemctl status gunicorn다음 오류가 발생합니다.

● gunicorn.service - gunicorn daemon
     Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2021-08-31 20:53:12 UTC; 6min ago
TriggeredBy: ● gunicorn.socket
    Process: 1918 ExecStart=/home/houssem/project/env/bin/gunicorn --access-logfile - --workers 3 --bind unix:/run/gunicorn.sock config.wsgi:application (code=exited, >
   Main PID: 1918 (code=exited, status=3)

Aug 31 20:53:12 ubuntu-20-lts gunicorn[1932]:   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
Aug 31 20:53:12 ubuntu-20-lts gunicorn[1932]:   File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
Aug 31 20:53:12 ubuntu-20-lts gunicorn[1932]: ModuleNotFoundError: No module named 'django_extensions'
Aug 31 20:53:12 ubuntu-20-lts gunicorn[1932]: [2021-08-31 20:53:12 +0000] [1932] [INFO] Worker exiting (pid: 1932)
Aug 31 20:53:12 ubuntu-20-lts gunicorn[1918]: [2021-08-31 20:53:12 +0000] [1918] [WARNING] Worker with pid 1931 was terminated due to signal 15
Aug 31 20:53:12 ubuntu-20-lts gunicorn[1918]: [2021-08-31 20:53:12 +0000] [1918] [WARNING] Worker with pid 1932 was terminated due to signal 15
Aug 31 20:53:12 ubuntu-20-lts gunicorn[1918]: [2021-08-31 20:53:12 +0000] [1918] [INFO] Shutting down: Master
Aug 31 20:53:12 ubuntu-20-lts gunicorn[1918]: [2021-08-31 20:53:12 +0000] [1918] [INFO] Reason: Worker failed to boot.
Aug 31 20:53:12 ubuntu-20-lts systemd[1]: gunicorn.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
Aug 31 20:53:12 ubuntu-20-lts systemd[1]: gunicorn.service: Failed with result 'exit-code'.

이 명령을 실행하면 gunicorn config.wsgi:application --preload -b 0.0.0.0:8000제대로 작동하고 IP 주소를 사용하여 사이트에 액세스할 수 있습니다.

내 파일 gunicorn.service/etc/systemd/system/gunicorn.socket파일은 다음과 같습니다.

# /etc/systemd/system/gunicorn.service
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target

[Service]
User=sammy
Group=www-data
WorkingDirectory=/home/sammy/myprojectdir
ExecStart=/home/sammy/myprojectdir/myprojectenv/bin/gunicorn \
          --access-logfile - \
          --workers 3 \
          --bind unix:/run/gunicorn.sock \
          myproject.wsgi:application

[Install]
WantedBy=multi-user.target
[Unit]
Description=gunicorn socket

[Socket]
ListenStream=/run/gunicorn.sock

[Install]
WantedBy=sockets.target

이 이전에 gunicorn과 관련된 (가이드에서) 언급된 모든 명령은 sudo systemctl status gunicorn예상대로 작동하며 가이드와 동일한 출력을 인쇄합니다.

솔루션을 검색했지만 이 문제를 해결하는 방법을 알 수 없습니다. 저는 gunicorn을 처음 사용합니다.

누구든지 이 문제를 해결하도록 도와줄 수 있나요?

제공된 정보가 충분하지 않은 경우 더 자세한 내용을 제공할 수 있습니다.

편집하다

패키지에 대해서는 이미 요구사항.txt 파일에서 virtualenv에 패키지를 설치했습니다 pip install -r requirements.txt. 또한 전 세계적으로 django-extension을 설치했지만 여전히 동일한 오류가 발생합니다.

관련 정보