简体   繁体   English

Google App Engine 不为我在 app.yaml 中定义的入口点提供服务

[英]Google App Engine is not servig my defined entrypoint in app.yaml

Google App Engine will not serve my defined entrypoint on python37 runtime. Google App Engine 不会在 python37 运行时提供我定义的入口点。 GAE still try to serve a main.py file. GAE 仍然尝试提供main.py文件。

Project structure项目结构

/backend/__init__.py
/backend/views.py
/backend/models.py
app.yaml

app.yaml应用程序.yaml

service: backend
runtime: python37
entrypoint: gunicorn -b :$PORT backend:app
handlers:
  - url: /.*
    script: auto
    secure: always
    redirect_http_response_code: 301

/backend/ init .py /后端/初始化.py

from flask import Flask
...
app = Flask(__name__)
...
import backend.models
import backend.views
if __name__ == '__main__':
    app.run()

GAE error message GAE 错误信息

File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked: ModuleNotFoundError: No module named 'main'

If you specify a custom entrypoint in your app.yaml file with gunicorn you have to install gunicorn in your requirements.txt .如果指定了一个自定义的entrypoint在你app.yaml与文件gunicorn你必须安装gunicornrequirements.txt That did the trick for me and solved this issue!这对我有用并解决了这个问题!

You need to configure gunicorn to look at the directory where your init.py is located.你需要配置gunicorn来查看你的init.py所在的目录。 There are two ways to do this on your entrypoint:有两种方法可以在您的入口点执行此操作:

entrypoint: gunicorn -b :$PORT --chdir backend init:app 

or或者

entrypoint: gunicorn -b :$PORT backend.init:app 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google App Engine | Python |的app.yaml - Google App Engine | Python | APP.YAML 如何使用App Engine app.yaml文件中定义的路由从Google Cloud Storage提供内容? - How to serve content from Google Cloud Storage with routes defined in App Engine app.yaml file? 如何为Google App Engine应用程序写入`app.yaml`文件? - How to write `app.yaml` file for Google App Engine app? app.yaml文件:运行2个Python文件Google App Engine - app.yaml file: Running 2 Python Files Google App Engine app.yaml /项目文件结构适用于app引擎localhost调试器,但不适用于谷歌应用引擎服务器 - app.yaml / project file structure works on app engine localhost debugger but not on google app engine server 如何使用应用工厂将 Flask 应用部署到 Google Cloud(App Engine),以及如何编写 app.yaml 文件? - How to deploy a Flask app to Google Cloud (App Engine) with an application factory, and how to write the app.yaml file? 如何在登录名中使用自定义身份验证:app.yaml中的required属性(Google App引擎,python) - How to use custom authentication with the login: required attribute in app.yaml ( Google app engine, python ) 要在Google App Engine上托管静态(HTML)网站,app.yaml文件中应包含哪些内容? - To host a static (HTML) website on Google App Engine, what should be in the app.yaml file? Google App Engine:运行dev_appserver.py app.yaml,但没有任何反应 - Google App Engine: run dev_appserver.py app.yaml but nothing happens 问:谷歌应用引擎app.yaml如何处理main.py中的网址? - Q: google app engine app.yaml how to handle urls from within main.py?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM