title: Google App Engine: Using custom entry point with Python
body: <p>I'm starting to learn Google App Engine, and have written a basic main.py file with a Flask application, which works fine.  Here's the first few lines of code:</p>
  <pre><code>from flask import Flask, jsonify
  
  app = Flask(__name__)
  
  @app.route(&quot;/&quot;)
  def root():
      return jsonify({'status': &quot;Success!&quot;}), 200
  </code></pre>
  <p>I wanted to change the name of the script, so I renamed it 'test-app.py' and added this line to app.yaml:</p>
  <pre><code>runtime: python38
  entrypoint: test-app:app
  </code></pre>
  <p>Then re-run gcloud app deploy.  The deployment is successful, but app returns 500 with this in the logs:</p>
  <pre><code>2021-05-09 22:23:40 default[20210509t222122]  &quot;GET / HTTP/1.1&quot; 500
  2021-05-09 22:23:41 default[20210509t222122]  /bin/sh: 1: exec: test-app:app: not found
  </code></pre>
  <p>I also tried these from the <a href="https://cloud.google.com/appengine/docs/flexible/python/runtime#application_startup" rel="noreferrer">documentation</a>:</p>
  <pre><code>entrypoint: gunicorn -b :$PORT test-app:app
  entrypoint: uwsgi --http :$PORT --wsgi-file test-app.py --callable application
  </code></pre>
  <p>In both cases, logs show &quot;/bin/sh: 1: exec: (gunicorn|uwsgi): not found&quot;</p>
  <p>In Lambda, the Entry point is set via the handler option, which is by default a function called lambda_handler() in a file called lambda_function.  It would appear App Engine uses &quot;app&quot; inside &quot;main.py&quot;, but what's the proper syntax for changing this?</p>