[英]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
你必须安装gunicorn
在requirements.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.