前提・実現したいこと
AWSのEC2内でgunicornの設定をしているのですが、gunicornのstatusがどうしても失敗と表示されてしまいます。
発生している問題・エラーメッセージ
sudo systemctl start gunicorn sudo systemctl enable gunicorn
以上のコマンドでgunicornを起動させて自動起動を有効化させ、
sudo systemctl status gunicorn
を打つとこういったエラーが表示されてしまいます。
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 Sun 2022-01-30 16:18:32 UTC; 1min 36s ago Main PID: 52535 (code=exited, status=203/EXEC) Jan 30 16:18:32 ip-172-16-1-90 systemd[1]: Started gunicorn daemon. Jan 30 16:18:32 ip-172-16-1-90 systemd[52535]: gunicorn.service: Failed to execute command: No such file or directory Jan 30 16:18:32 ip-172-16-1-90 systemd[52535]: gunicorn.service: Failed at step EXEC spawning /home/ubuntu/mapwith-django/env/bin/gunicorn: No such file or directory Jan 30 16:18:32 ip-172-16-1-90 systemd[1]: gunicorn.service: Main process exited, code=exited, status=203/EXEC Jan 30 16:18:32 ip-172-16-1-90 systemd[1]: gunicorn.service: Failed with result 'exit-code'.
gunicornはEC2にログインし、git cloneでクローンしてきたmapwith-djangoディレクトリに移動し、python3 -m venv env で仮想環境を作りsource env/bin/activate で仮想環境に入り、pip install gunicorn でインストールという手順を踏みました。
また、sudo vim /etc/systemd/system/gunicorn.serviceで編集したファイルは以下の通りです。
[Unit] Description=gunicorn daemon After=network.target [Service] User=ubuntu Group=www-data WorkingDirectory=/home/ubuntu/mapwith-django ExecStart=/home/ubuntu/mapwith-django/env/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/ubuntu/mapwith-django/drf_mapwith.socket drf_mapwith.wsgi:application RemainAfterExit=yes [Install] WantedBy=multi-user.target
試したこと
cd mapwith-django/env/bin で移動し、lsコマンドを押すと
__pycache__ activate activate.csh activate.fish django-admin django-admin.py easy_install easy_install-3.7 normalizer pip pip3 pip3.7 python python3 sqlformat
とgunicornが表示されませんでした。pipでインストールしたので表示されないのでしょうか??
パスが原因だと思うのですがよくわからないため、ぜひご協力いただけるとありがたいです。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
回答1件
あなたの回答
tips
プレビュー