Issue
please help, I do not have experience deploying, I have been trying for days, bear with me. Thanks.
I have been working on a angular app with flask backend and both work proper locally, I need to deploy them. The server is written in flask and it is accessible via Postman. The page renders properly from "https://apt-trainer-279210.uc.r.appspot.com/" but on API call an error 404 not found when calling "api/landing" to my server. Going to the logs on GAE I see error.
Static file referenced by handler not found: dist/api/landing
I am guessing that its looking for file in the above path but it should be calling my server instead. Below is my app.yaml file for angular:
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /
static_files: dist/index.html
upload: dist/index.html
- url: /
static_dir: dist
skip_files:
- e2e/
- node_modules/
- src/
- coverage
- ^(.*/)?\..*$
- ^(.*/)?.*\.json$
- ^(.*/)?.*\.md$
- ^(.*/)?.*\.yaml$
- ^LICENSE
Also note that in the angular app I proxy to the server:
{
"/api": {
"target": "http://civil-planet-279210.uc.r.appspot.com" ,
"secure": true,
"logLevel": "debug",
"changeOrigin": true,
"pathRewrite": {
"^/api/*": ""
}
}
}
A Similar question was also posted but the user was using Cloud Endpoints while my server is in python flask. I could not use the solution.
Not sure if I should post the app.yaml for the python server as it is working properly.
Your assistance would be greatly appreaciated.
Solution
Was able to fix the issue with the following yaml – I was missing the third handler.
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /
static_files: dist/index.html
upload: dist/index.html
- url: /
static_dir: dist
- url: /.*
script: auto
secure: always
redirect_http_response_code: 301
skip_files:
- e2e/
- node_modules/
- src/
- coverage
- ^(.*/)?\..*$
- ^(.*/)?.*\.json$
- ^(.*/)?.*\.md$
- ^(.*/)?.*\.yaml$
- ^LICENSE