안녕하세요 점프투장고 4-09 질문수정해서 다시 올립니다
현재 Gunicorn 소켓 사용해보기 까지 진행하고 그 다음 Gunicorn 서비스로 등록하기 단계입니다
여기서
sudo systemctl start mysite.service
를 입력하여 실행시키면 터미널에선 아무 반응이없고 syslog 에서는 다음과 같이 표시됩니다.
Jun 28 17:18:27 ip-172-26-11-10 systemd[1]: Started gunicorn daemon.
Jun 28 17:18:27 ip-172-26-11-10 systemd[96922]: mysite.service: Failed to execute command: No such file or directory
Jun 28 17:18:27 ip-172-26-11-10 systemd[96922]: mysite.service: Failed at step EXEC spawning /home/Ubuntu/venvs/mysite/bin/gunicorn: No such file or directory
Jun 28 17:18:27 ip-172-26-11-10 systemd[1]: mysite.service: Main process exited, code=exited, status=203/EXEC
Jun 28 17:18:27 ip-172-26-11-10 systemd[1]: mysite.service: Failed with result 'exit-code'.
책과 다른 settings 값은 이러합니다
config/settings/base.py
from pathlib import Path
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent.parent
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [str(BASE_DIR.joinpath('templates'))],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
STATIC_URL = '/static/'
STATICFILES_DIRS = [
BASE_DIR / "static",
'/projects/mysite/static/',
]
이것은 장고버젼에 따라 다른분이 쓰신글을 보고 제 장고버젼이 최신버젼이라 수정한것 입니다.
config/settings/prod.py
from .base import *
ALLOWED_HOSTS = ['13.124.147.130']
#STATIC_ROOT = BASE_DIR / 'static/'
#STATICFILES_DIRS = []
#DEBUG = False
아직 4-09 단계라 주석처리 해두었습니다.
/tmp/ 안에 소켓파일은 없구요, /home/ubuntu/venvs/mysite/bin/ 위치에 gunicorn 있습니다
무엇이 문제일까요? ㅜ
아참 mysite.servce 내용은 이러합니다
[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
SmileBear 님 486
M 2022년 6월 28일 5:49 오후