我已经指定了app.yaml
文件,如下所示:
runtime: python
env: standard
# this assumes that the entrypoint is app.py
entrypoint: gunicorn -b :$PORT main:app
threadsafe: true
运行gcloud app deploy
后,我面临500错误,日志显示以下内容
Traceback (most recent call last):
File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/base/data/home/apps/g~test-website/20170924t080410.404328292497306090/app.py", line 3, in <module>
from flask import Flask, render_template
ImportError: No module named flask
任何人都可以帮我配置标准环境
答案 0 :(得分:1)
您正在为app.yaml
查看documentation for the app.yaml
并坚持使用标准环境参考。 env
参数仅用于flex
,而entrypoint
仅用于flex。 runtime
参数应为python27
,因为python
表示已弃用的Python 2.5运行时。
鉴于您尝试使用Flask,您应该阅读getting started guide that is specifically for Flask。