简体   繁体   English

在Google App Engine的标准环境中,烧瓶导入失败

[英]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参数仅用于flexentrypoint点仅用于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.

相关问题 Google App Engine标准环境(Python + SAML) - Google App Engine Standard Environment (Python + SAML) Google App Engine标准环境中的gunicorn服务器 - gunicorn server in Google App Engine Standard Environment Flask on Python 3.7 比使用 Google App Engine 标准环境的 Python 2.7 上的 webapp2 要求更高(也更昂贵) - Flask on Python 3.7 more demanding (and expensive) than webapp2 on Python 2.7 with Google App Engine Standard environment Jinja2无法在Google App Engine上导入 - Jinja2 failing to import on Google App Engine Google App Engine Django标准环境:错误:服务器错误 - Google App Engine Django Standard Environment: Error: Server Error Google App Engine标准环境可以连接到GRPC服务吗? - Can Google App Engine Standard environment connect to a GRPC service? 是否可以从App Engine标准环境访问Google Pub / Sub? - Access Google Pub/Sub from App Engine standard environment? 使用 Google App Engine 时无法导入 Flask - Can't import Flask while using Google App Engine 无法使用 Apache 将 sklearn 导入 Google Compute Engine 上的 Flask App - Can’t Import sklearn into Flask App on Google Compute Engine with Apache Google App Engine本地环境错误:“无法导入名称webapp” - Google App Engine Local Environment Error: “cannot import name webapp”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM