Dynamic HTML Page not found in App Engine. Returns Cannot Get /index

笑着哭i 提交于 2021-01-29 07:39:56

问题


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 the nodejs10 or nodejs8 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!