开发者

Root html (/index.html) can't be fetched. Returns 404

The dir structure is-

MyApplication (Project Dir)

-static
   --inside static, I got different dirs containing images, css, htmls, etc
-some other dirs
-app.yaml
-index.py
-index.html

The content of app.yaml is-

application: MyApplicationID
version: 1
runtime: python
api_version: 1

handlers:

- url: /favicon.ico
  static_files: static/images/favicon.ico
  upload: static/images/favicon.ico
  mime_type: image/x-icon

- url: /robots.txt
  static_files: static/robots.txt
  upload: static/robots.txt

- url: /static
  static_dir: stati开发者_运维知识库c  
  secure: optional

- url: /projects
  static_dir: projects  
  secure: optional

- url: /about
  static_dir: about  
  secure: optional

- url: /
  static_files: index.html
  upload: index.html

- url: /.*
  script: index.py
  secure: optional

Everything works fine except that if anything on the html pages are redirecting to "index.html" gets me a page not found ("GET /index.html HTTP/1.1" 404 -) error. I tried follwing this - https://gist.github.com/873098 but still no luck. I tried other suggestions on other threads but still no luck. If I remove - url: / still no luck. Please advise.


The other person is right, you don't have an entry for the url index.html, like

- url: /index.html
  static_files: index.html
  upload: index.html

Edit 2: Just to be clear, no matter what is on the static_files line, this will still result in a URL of http://mysite.com/index.html even if the static_files line includes a subdirectory.


Requests for "/index.html" will be handled by index.py, given the contents of your app.yaml. Presumably you don't have a handler for "/index.html" in that file.

If you want index.html served for requests for "/index.html", add a mapping to app.yaml that matches the URL (or, just redirect to "/" instead of "/index.html" elsewhere in the site, which is less ugly)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜