DjangoをEC2でデプロイする方法
解決したいこと
DjangoのアプリをEC2でデプロイしたいです。
gunicornとnginxを使用しているのですが設定がうまくできません。
エラーの解決方法を教えていただけないでしょうか。
発生している問題・エラー
● gunicorn.service - gunicorn daemon
Loaded: error (Reason: Invalid argument)
Active: failed (Result: exit-code) since 日 2022-02-27 09:19:14 UTC; 1h 30min ago
Main PID: 14745 (code=exited, status=203/EXEC)
2月 27 09:19:14 ip-10-0-10-248.ap-northeast-1.compute.internal systemd[14745]: Failed at step EXEC spawning /usr/local/bin/gunicorn: No such file or directory
2月 27 09:19:14 ip-10-0-10-248.ap-northeast-1.compute.internal systemd[1]: gunicorn.service: main process exited, code=exited, status=203/EXEC
2月 27 09:19:14 ip-10-0-10-248.ap-northeast-1.compute.internal systemd[1]: Unit gunicorn.service entered failed state.
2月 27 09:19:14 ip-10-0-10-248.ap-northeast-1.compute.internal systemd[1]: gunicorn.service failed.
2月 27 09:34:01 ip-10-0-10-248.ap-northeast-1.compute.internal systemd[1]: [/etc/systemd/system/gunicorn.service:10] Executable path is not absolute, ignoring: ~/ven...ication
2月 27 09:34:01 ip-10-0-10-248.ap-northeast-1.compute.internal systemd[1]: [/etc/systemd/system/gunicorn.service:11] Unknown lvalue 'RemainAfterExist' in section 'Service'
2月 27 09:34:01 ip-10-0-10-248.ap-northeast-1.compute.internal systemd[1]: gunicorn.service lacks both ExecStart= and ExecStop= setting. Refusing.
2月 27 09:35:48 ip-10-0-10-248.ap-northeast-1.compute.internal systemd[1]: [/etc/systemd/system/gunicorn.service:10] Executable path is not absolute, ignoring: ~/.lo...ication
2月 27 09:35:48 ip-10-0-10-248.ap-northeast-1.compute.internal systemd[1]: [/etc/systemd/system/gunicorn.service:11] Unknown lvalue 'RemainAfterExist' in section 'Service'
2月 27 09:35:48 ip-10-0-10-248.ap-northeast-1.compute.internal systemd[1]: gunicorn.service lacks both ExecStart= and ExecStop= setting. Refusing.
Warning: gunicorn.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Hint: Some lines were ellipsized, use -l to show in full.
例)
NameError (uninitialized constant World)
または、問題・エラーが起きている画像をここにドラッグアンドドロップ
該当するソースコード
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=ec2-user
Group=www-data
WorkingDirectory=/home/ec2-user/econal
ExecStart=/home/ec2-user/venv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/ec2-user/econal/econal.sock wsgi:application
RemainAfterExist=yes
[Install]
WantedBy=multi-user.target
自分で試したこと
ネットで調べながら色々試していましたがやっていることの意味を理解しきれていない状況です
0 likes