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:
from flask import Flask, jsonify
app = Flask(__name__)
@app.route("/")
def root():
return jsonify({'status': "Success!"}), 200
I wanted to change the name of the script, so I renamed it 'test-app.py' and added this line to app.yaml:
runtime: python38
entrypoint: test-app:app
Then re-run gcloud app deploy. The deployment is successful, but app returns 500 with this in the logs:
2021-05-09 22:23:40 default[20210509t222122] "GET / HTTP/1.1" 500
2021-05-09 22:23:41 default[20210509t222122] /bin/sh: 1: exec: test-app:app: not found
I also tried these from the documentation:
entrypoint: gunicorn -b :$PORT test-app:app
entrypoint: uwsgi --http :$PORT --wsgi-file test-app.py --callable application
In both cases, logs show "/bin/sh: 1: exec: (gunicorn|uwsgi): not found"
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 "app" inside "main.py", but what's the proper syntax for changing this?