在谷歌应用引擎中从标准环境迁移到灵活环境

时间:2016-11-28 15:45:04

标签: app-engine-flexible

I'm migrating my standard environment app to flexible environment in GAE and facing issues.

app.yaml snippet

runtime: custom
env: flex
api_version: 1
threadsafe: true

handlers:

- url: /.*
  script: main.app

Dockerfile

FROM gcr.io/google_appengine/python-compat-multicore
RUN apt-get update -y
RUN apt-get install -y python-pip build-essential libssl-dev libffi-dev python-dev libxml2-dev libxslt1-dev xmlsec1

RUN apt-get install -y curl unzip
RUN curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz > /tmp/google-cloud-sdk.tar.gz
RUN mkdir -p /usr/local/gcloud
RUN tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz
RUN /usr/local/gcloud/google-cloud-sdk/install.sh

RUN curl https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.40.zip > /tmp/google_appengine_1.9.40.zip
RUN unzip /tmp/google_appengine_1.9.40.zip -d /usr/local/gae

ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin
ENV PATH $PATH:/usr/local/gae/google_appengine/
COPY . /app
WORKDIR /app

ENV MODULE_YAML_PATH app.yaml

RUN pip install -r requirements.txt
运行gcloud app deploy(堆栈跟踪)时出现

问题

 File "/env/local/lib/python2.7/site-packages/google/appengine/ext/vmruntime/vmconfig.py", line 63, in BuildVmAppengineEnvConfig
    escaped_appid = appid.replace(':', '_').replace('.', '_')
AttributeError: 'NoneType' object has no attribute 'replace'

我在dockerfile中缺少什么?应该进行哪些其他配置更改,以便没有太多的应用程序级代码更改。是否可以在灵活的环境中使用webapp2

1 个答案:

答案 0 :(得分:0)

我们正在研究更好的错误消息,但这种情况正在发生,因为您正在尝试使用python-compat-multicore运行时。该运行时在env:flex上不支持 ,并且已被弃用。我们要求大家按照本指南升级到运行时:python:

https://cloud.google.com/appengine/docs/flexible/python/migrating