Created a new python Flask app-engine python project and want to use the static files from Google cloud storage. I am using this yaml.file
:
runtime: python env: flex entrypoint: gunicorn -b :$PORT main:app runtime_config: python_version: 3
Where in the app engine do you link to storage https://storage.googleapis.com/<your-bucket-name>/static/
with /static
in the app-engine? It is not clear from the documentation.
Advertisement
Answer
You can’t use file stored on Google Cloud Storage as static folder in your App Engine environment. The solution proposed by the documentation is to have 2 sources (2 URL): one for the static file on GCS, the other for the backend on App Engine Flex.
The main issue with this design is the CORS issues. Personally I prefer another design.
- Set up a HTTPS load balancer
- Create a bucket backend to serve your source from GCS
- Create a serverless NEG to serve your dynamic backend (on App Engine flex)
- Customize your Path rule to route correctly the ressource to your respective backends
- Set a unique DNS in front of your HTTPS Load Balancer (no CORS management in this case)