title: Migrating from standard to flexible environment in google app engine
body: <pre><code>I'm migrating my standard environment app to flexible environment in GAE and facing issues.
  </code></pre>
  
  <h2>app.yaml snippet</h2>
  
  <pre><code>runtime: custom
  env: flex
  api_version: 1
  threadsafe: true
  
  handlers:
  
  - url: /.*
    script: main.app
  </code></pre>
  
  <h2>Dockerfile</h2>
  
  <pre><code>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 &gt; /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 &gt; /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
  </code></pre>
  
  <h2>issue while running gcloud app deploy(stack trace)</h2>
  
  <pre><code> 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'
  </code></pre>
  
  <p><strong>Is there anything which I'm missing in dockerfile? What are the other configuration changes which should be done such that there is not much application level code changes. Is it advidsable to use webapp2 in flexible environment</strong></p>