apache, wsgi, get_wsgi_application no module named '세팅있는 폴더'

boingboing·2022년 1월 14일
0

현상

아파치랑 연결하다 발생한 에러

wsgi.py에서 application = get_wsgi_application()을 할 때 발생함..ㅇ<-<

원인

system 환경변수를 안넣어줘서 그랬음.

You have to append your project dir and your virtualenv site-packages to the sys.path List.

장고 프로젝트 경로를 시스템 PATH에 넣어줘야 한다. 안 그러면 wsgi 실행 시 내 장고 폴더를 못 찾음.

# =====================
# wsgi.py file begin 

import os, sys
# add the hellodjango project path into the sys.path
sys.path.append('<PATH_TO_MY_DJANGO_PROJECT>/hellodjango')

# add the virtualenv site-packages path to the sys.path
sys.path.append('<PATH_TO_VIRTUALENV>/Lib/site-packages')

# poiting to the project settings
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hellodjango.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

# wsgi.py file end
# ===================

https://stackoverflow.com/questions/14927345/importerror-no-module-named-django-core-wsgi-apache-virtualenv-aws-wsgi

0개의 댓글