장고 306 페이지 active:failed(Result: exit-code)

systemctl start하고 status를 실행하면 다음과 같이 Active:fialed 오류가 발생합니다. 어디가 잘못된 것일까요?
아래 HaltServer 관련 오류인거 같은데 어떻게 해결해야 하나요?

(mysite) ubuntu@ip-172-26-11-149:/etc/systemd/system$ sudo systemctl start mysite.service
(mysite) ubuntu@ip-172-26-11-149:/etc/systemd/system$ sudo systmectl status mysite.service
sudo: systmectl: command not found
(mysite) ubuntu@ip-172-26-11-149:/etc/systemd/system$ sudo systemctl status mysite.service
● mysite.service - gunicorn daemon
Loaded: loaded (/etc/systemd/system/mysite.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2022-12-26 23:37:20 KST; 57s ago
Process: 103229 ExecStart=/home/ubuntu/venvs/mysite/bin/gunicorn --workers 2 --bind unix:/tmp/gunicorn.sock config.wsgi:application (code=exited, status=>
Main PID: 103229 (code=exited, status=1/FAILURE)

Dec 26 23:37:20 ip-172-26-11-149 gunicorn[103229]: self.stop()
Dec 26 23:37:20 ip-172-26-11-149 gunicorn[103229]: File "/home/ubuntu/venvs/mysite/lib/python3.8/site-packages/gunicorn/arbiter.py", line 393, in stop
Dec 26 23:37:20 ip-172-26-11-149 gunicorn[103229]: time.sleep(0.1)
Dec 26 23:37:20 ip-172-26-11-149 gunicorn[103229]: File "/home/ubuntu/venvs/mysite/lib/python3.8/site-packages/gunicorn/arbiter.py", line 242, in handle_ch>
Dec 26 23:37:20 ip-172-26-11-149 gunicorn[103229]: self.reap_workers()
Dec 26 23:37:20 ip-172-26-11-149 gunicorn[103229]: File "/home/ubuntu/venvs/mysite/lib/python3.8/site-packages/gunicorn/arbiter.py", line 525, in reap_work>
Dec 26 23:37:20 ip-172-26-11-149 gunicorn[103229]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
Dec 26 23:37:20 ip-172-26-11-149 gunicorn[103229]: gunicorn.errors.HaltServer:
Dec 26 23:37:20 ip-172-26-11-149 systemd[1]: mysite.service: Main process exited, code=exited, status=1/FAILURE
Dec 26 23:37:20 ip-172-26-11-149 systemd[1]: mysite.service: Failed with result 'exit-code'.
lines 1-16/16 (END)

/var/log/syslog에서도 아래쪽에 다음과 같은 오류가 뜹니다.

Dec 27 00:16:52 ip-172-26-11-149 gunicorn[103345]: gunicorn.errors.HaltServer:
Dec 27 00:16:52 ip-172-26-11-149 systemd[1]: mysite.service: Main process exited, code=exited, status=1/FAILURE
Dec 27 00:16:52 ip-172-26-11-149 systemd[1]: mysite.service: Failed with result 'exit-code'.

cezips 620

2022년 12월 27일 12:28 오전

gunicorn말고 장고서버로 실행했을때 오류가 없는지 먼저 확인해 보세요. - 박응용님, 2022년 12월 27일 12:26 오후 추천 , 대댓글
@박응용님 장고서버에서는 오류없이 잘 작동하는 거 같습니다. 정적 페이지도 잘 읽어 들입니다. - cezips님, 2022년 12월 27일 9:53 오후 추천 , 대댓글
@cezips님 그러면 작성하신 코드는 이상이 없는것 같구요, 구니콘도 서비스 모드 말고 단독으로 실행이 잘되는지 확인해 보세요. - 박응용님, 2022년 12월 27일 10:25 오후 추천 , 대댓글
@박응용님 guincorn --bind(생략) 명령으로 단독으로 실행해도 사이트가 잘 뜹니다. - cezips님, 2022년 12월 28일 9:37 오후 추천 , 대댓글
@cezips님 그렇다면 모두 이상이 없네요. 다만, 구니콘을 서비스로 실행할때만 안되는 상황으로 보입니다. 서비스 파일도 단순히 구니콘을 동작시키는 스크립트인데요.. 작성하신 서비스 파일을 한번 보여주세요. - 박응용님, 2022년 12월 28일 10:27 오후 추천 , 대댓글
목록으로
1개의 답변이 있습니다. 1 / 1 Page

서비스 화일을 다음과 같이 작성했습니다.

"""
[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=ubuntu
Group=ubuntu
WorkingDirectory=/home/ubuntu/projects/mysite
EnvironmentFile=/home/ubuntu/venvs/mysite.env
ExecStart=/home/ubuntu/venvs/mysite/bin/gunicorn \
--workers 2 \
--bind unix:/tmp/gunicorn.sock \
config.wsgi:application

[Install]
WantedBy=multi-user.target

"""

cezips

2022년 12월 28일 10:45 오후

서비스 파일도 문제가 없네요. 먼 길을 달려왔는데 해결을 못해 드렸네요. mysite.env 파일에 환경변수가 잘 설정되었는지 확인해 보시고, 혹시 책과 다른 환경이 있는지도 한번 확인해 보세요. 지금까지 알려주신 내용으로는 잘못된 부분이 없습니다. - 박응용님, 2022년 12월 29일 8:27 오전 추천 , 대댓글
@박응용님 플라스크를 하면서 장고도 다시 가상환경 만들어 진행해 보고 있습니다. 당장은 해결하지 못하지만 언젠가는 알게 되겠지요. 감사합니다. - cezips님, 2022년 12월 30일 1:08 오전 추천 , 대댓글