我开发了基于Python 3.6和Django 2.0的Web应用程序,并希望首次在Google App Engine中进行部署。当我尝试部署(gcloud app deploy
)时,它没有通过,并向我显示了以下错误消息:
(acct) C:\Users\tsjee_000\dev\acct\src>gcloud app deploy
ERROR: (gcloud.app.deploy) An error occurred while parsing file: [C:\Users\tsjee_000\dev\acct\src\app.yaml]
libraries entries are only supported by the "python27" runtime
in "C:\Users\tsjee_000\dev\acct\src\app.yaml", line 34, column 13
app.yaml:
runtime: python
api_version: 1
threadsafe: yes
env: flex
entrypoint: gunicorn -b :$PORT main:app
handlers:
- url: /static
static_dir: static/
- url: .*
script: acct.wsgi.application
libraries:
- name: MySQLdb
version: 1.2.5
GAE还不支持Python 3和Django 2吗?我一直在寻找答案,并尝试了多种方法,但是没有用。
答案 0 :(得分:5)
您正在将standard environment app.yaml
配置元素(在您的情况下为libraries
)混合到flexible environment app.yaml
配置文件中,这会导致您看到错误。
注意:
handlers
配置,例如,特定于标准环境的在灵活的环境中,可以对依赖项进行管理:
requirements.txt
文件,有关python的依赖性,请参见Using Python Libraries 答案 1 :(得分:-1)
尝试添加:
runtime_config:
python_version: 3
通过https://cloud.google.com/appengine/docs/flexible/python/runtime