[英]Flask import is failing in standard environment of Google App Engine
I have specified an app.yaml
file as follows: 我指定了一个
app.yaml
文件,如下所示:
runtime: python
env: standard
# this assumes that the entrypoint is app.py
entrypoint: gunicorn -b :$PORT main:app
threadsafe: true
After running gcloud app deploy
I'm faced with a 500 error and the logs reveal the following 运行
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
Can anyone help me configure a standard environment 谁能帮我配置标准环境
You are combining syntax for the flexible environment and the standard environment in your app.yaml
您正在
app.yaml
中结合灵活环境和标准环境的语法
Look at the documentation for the app.yaml
and stick to the standard environment reference. 查看
app.yaml
的文档,并app.yaml
标准环境参考。 The env
parameter is only used for flex
and entrypoint
is only for flex. env
参数仅用于flex
, entrypoint
点仅用于flex。 The runtime
parameter should be python27
as python
means the deprecated Python 2.5 runtime. runtime
参数应为python27
因为python
表示已弃用的Python 2.5运行时。
Given that you're trying to use Flask, you should probably read the getting started guide that is specifically for Flask . 鉴于您正在尝试使用Flask,可能应该阅读专门针对Flask的入门指南 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.