최근 GAE은 python3.7을 지원하기 시작했습니다. 간단한 Flask app을 GAE에 deploy해보았고 과정에 대해서 간략히 정리하였습니다.
프로젝트 생성
먼저 프로젝트 폴더 생성하고, 기본적인 파일들을 생성합니다.
$ mkdir flask-python37
$ cd flask-python37app.yaml 생성
runtime: python37requirements.txt 생성
Flask==1.0.2의존성 설치
pip install  -r requirements.txtmain.py 생성
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
  return "Hello"
if __name__ == '__main__':
    app.run(host='127.0.0.1', port=8088, debug=True)  로컬에서 실행(Run locally)
간단히 Hello를 출력하는 프로그램을 만들었습니다. 이제 로컬에서 실행해보겠습니다.
$ python main.py
 * Serving Flask app "main" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:8088/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 289-847-358Deploy
로컬에서 테스트가 되었다면 이제 GAE에 deploy해보겠습니다.
$ gcloud app deploy
$ gcloud app browseTroubleshooting
저의 경우 gcloud app deploy할 때 아래처럼 ERROR가 발생하였는데, gcloud sdk를 업데이트하라고 해서, 최신 버전으로 재설치해주니 해결되었습니다.
Beginning deployment of service [default]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 0 files to Google Cloud Storage                ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: Please update to the latest version of gcloud. If you are using the API directly, please provide a value for version.entrypoint.shell. This can be an empty value.참고
- Sample code는 Github에 있습니다
- Google Cloud
Loading script...
Related Posts
- ESLint warning, Expected '===' and instead saw '==' eqeqeq
- Python - Yaml 파일 파싱하는 방법
- Python - pip와 requirements.txt로 패키지 관리
- 유튜브 쇼츠(Shorts) 자막 끄기/켜기
- SOLID 원칙, 객체지향 설계 5가지 원칙
- Ubuntu 20.04 - Nginx로 React를 배포하는 방법
- 애드센스 '구글 검색 기능' 블로그에 추가
- 트위터 이메일 안오게, 알림 끄기
- 인스타그램 동영상, 사진 저장 방법
- Git 설치 방법 (Ubuntu, Windows)
- Python pip 설치 (Ubuntu / Windows)
- 마우스 우클릭 복사 방지 해제 방법 (크롬)
- Python 에러 해결, 'conda' 용어가 cmdlet, 함수, 스크립트 ... 인식되지 않습니다.
- Python 에러 해결, AttributeError: module 'jwt' has no attribute 'encode'
- Atom - 코드 자동 정렬
- Sublime Text - 코드 자동 정렬, 단축키 설정
- VSCode에서 탭 간격 설정 (Tab to 4 spaces)
- Visual Studio Code에서 코드 자동 정렬
- 구글 검색 기록 삭제, 자동 저장 끄기 (PC, 모바일)
- 안드로이드 개발자 옵션 활성화, USB 디버깅 켜기
- 유튜브 채널 차단, 해제 방법 (PC, 모바일)
- 유튜브 미리보기 자동재생 끄기 (자동 소리 끄기/켜기)
- PC에서 유튜브 모바일 버전(m.youtube.com)으로 보기
- 모바일에서 유튜브 PC버전으로 보기
- 유튜브 시간 링크 만들기, 댓글에 시간 태그 입력하기
- 유튜브 스크립트 함께 보기, 자막 추출 방법
- 유튜브 알고리즘 초기화, 검색 기록과 시청 기록 삭제
- 유튜브 '싫어요' 숫자 다시 보이게 하기
- 구글 크롬, 방금 닫은 탭 다시 열기
- Maven으로 Java프로젝트 build하는 방법
- node.js, npm 버전 확인 방법 (터미널, cmd 명령어)
- GitLab - 'pre-receive hook declined' 에러 해결
- Javacript Heap Out Of Memory 문제 해결
- SSH key 생성하고 GitHub에 등록
- GMT, UTC의 차이점