问题
I am trying to host my HTML page in App Engine. When I am trying to access the webpage with url/index it returns
Cannot GET /index
I have followed the steps mentioned in https://cloud.google.com/appengine/docs/standard/python/getting-started/hosting-a-static-website having same file structure as it expects according to the link above.
- my_project
|- app.js
|- app.yaml
|- www
|- index.html
The below is my app.yaml file
# [START app_yaml]
runtime: nodejs
env: flex
service: service_name
# Adding CORS Support
handlers:
- url: /index
static_files: www/index.html
upload: www/index.html
- url: /index
static_dir: www/
- url: /getEndPoint
script: app.js
# [END CORS Support]
# [END app_yaml]
Not sure what am I missing here.
回答1:
You're following the python 1st generation standard environment documentation, but your app.yaml
selects the nodejs flexible environment (and uses statements not supported/ignored in this environment's app.yaml)
Maybe of interest: How to tell if a Google App Engine documentation page applies to the standard or the flexible environment
So you either:
- follow the nodejs flexible environment Serving Static Files documentation
- switch to the nodejs standard environment (by dropping the
env:flex
statement and selecting thenodejs10
ornodejs8
runtime) and follow the corresponding Serving Static Files documentation.
If you're unsure which environment you want, go through the Choosing an App Engine Environment guide.
来源:https://stackoverflow.com/questions/53854036/dynamic-html-page-not-found-in-app-engine-returns-cannot-get-index