When we use endpoints with std app engine environment Following lines in app.yaml, defines the starting point of the app
- url: /_ah/spi/.*
script: main.api
But as flex engine uses 'gunicorn' to define the staring point as given below
entrypoint: gunicorn -b :$PORT main:app
How should define main.py
of my cloud endpoint to be starting point with google app engine in flex environment ?
Edit1:
after the suggestion below from this link.
I updated my app.yaml to:
runtime: python
env: flex
entrypoint: gunicorn -b :$PORT main:api
service: s2
endpoints_api_service:
name: echo-api.endpoints.my-project-id.cloud.goog
config_id: my-config-id
but now while deploying, in my main.py file I get the import error
ImportError: No module named endpoints
even changing the import statment to
from google.appengine.ext import endpoints
does not help
Edit2:
I added the endpoints library to the project lib folder and also added appengine_config.py file to take care of this library, still it breaks at import endpoints
.
for my directory structure refer the image below
A summary from Quickstart for Endpoints on App Engine Flexible Environment (assuming python below, if using other language select the respective examples):
app.yaml
: