클라우드 Cloud/구글클라우드 GC

구글 앱 엔진 장고 Nginx 502 Bad gateway 뜨는 이유

Tap to restart 2021. 2. 26. 16:00
반응형

구글 앱 엔진에 장고 앱을 배포했다.

사이트로 들어갔는데 "502 Bad gateway"가 떴다.

nginx 502 Bad Gateway

여기서 알 수 있는 건 구글 앱 엔진은 nginx를 쓴다는 점이다.

 

이유는 main.py 설정 오류였다.

 

from mysite.wsgi import application

# App Engine by default looks for a main.py file at the root of the app
# directory with a WSGI-compatible object called app.
# This file imports the WSGI-compatible object of your Django app,
# application from mysite/wsgi.py and renames it app so it is discoverable by
# App Engine without additional configuration.
# Alternatively, you can add a custom entrypoint field in your app.yaml:
# entrypoint: gunicorn -b :$PORT mysite.wsgi
app = application

 

구글 앱 엔진은 기본적으로 main.py 파일을 찾기 때문에 이 파일이 없으면 502 Bad gateway가 뜬다

파일이 있어도 from mysite.wsgi 부분에 오류가 있어도 502 Bad gateway가 뜬다.

내 경우 mysite로 만들지 않고 다른 이름으로 만들었는데 main.py 파일만 복사했더니 오류가 났다.

수정하니 작동했다.

반응형