谷歌应用引擎GET /index.html HTTP / 1.1“404 -

时间:2013-03-30 21:55:31

标签: python google-app-engine

我有以下main.py文件:

 import webapp2

 class MainPage(webapp2.RequestHandler):
 def get(self):
    if self.request.url.endswith('/'):
        path = '%sindex.html'%self.request.url
    else:
        path = '%s/index.html'%self.request.url

    self.redirect(path)


 app = webapp2.WSGIApplication([('/.*', MainPage)],
                                     debug=True)

app.yaml文件:

 application: gtryapp
 version: 1
 runtime: python27
 api_version: 1
 threadsafe: yes

处理程序:

  • url:/images/(..(gif|png|jpg)) static_files:static / img / \ 1 上传:静态/ img /(.。(gif | png | jpg))

  • url:/css/(..css) mime_type:text / css static_files:static / css / \ 1 上传:静态/ css /(. .css)

  • url:/js/(..js) mime_type:text / javascript static_files:static / js / \ 1 upload:static / js /(. .js)

  • url:/(..html) mime_type:text / html static_files:static / \ 1 上传:静态/(. .html)

  • 网址:。* 脚本:main.app

库:

  • name:webapp2 版本:“2.5.2”

这是目录和文件的列表..为什么我得到404 ??

enter image description here

如果我写

  • url:/index.html

    mime_type:text / html

    static_files:index.html

    上传:index.html

它向我展示了index.html页面,但没有图片...这对于图像的正则表达式发生了什么很奇怪?

1 个答案:

答案 0 :(得分:2)

我很好地解决了这个问题:

 application: gtryapp
 version: 1
 runtime: python27
 api_version: 1
 threadsafe: yes

handlers:

- url: /images
  static_dir: images

- url: /css
  mime_type: text/css
  static_dir: css

- url: /js
  mime_type: text/javascript
  static_dir: js

- url: /scripts/1.1
  mime_type: text/javascript
  static_dir: scripts/1.1

- url: /(.*\.xml)
  mime_type: application/xml
  static_files: static/\1
  upload: static/(.*\.xml)

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

- url: /ydc-contacts.html
  mime_type: text/html
  static_files: ydc-contacts.html
  upload: ydc-contacts.html

- url: /ydc-graphic.html
  mime_type: text/html
  static_files: ydc-graphic.html
  upload: ydc-graphic.html

- url: /ydc-graphic_design-bauer_bodoni.html
  mime_type: text/html
  static_files: ydc-graphic_design-bauer_bodoni.html
  upload: ydc-graphic_design-bauer_bodoni.html

- url: /ydc-graphic_design-humac.html
  mime_type: text/html
  static_files: ydc-graphic_design-humac.html
  upload: ydc-graphic_design-humac.html

- url: /ydc-graphic_design-olo.html
  mime_type: text/html
  static_files: ydc-graphic_design-olo.html
  upload: ydc-graphic_design-olo.html

- url: /ydc-graphic_design-software.html
  mime_type: text/html
  static_files: ydc-graphic_design-software.html
  upload: ydc-graphic_design-software.html

- url: /ydc-interior-anagnina.html
  mime_type: text/html
  static_files: ydc-interior-anagnina.html
  upload: ydc-interior-anagnina.html

- url: /ydc-interior-ied_meets_cinecitto.html
  mime_type: text/html
  static_files: ydc-interior-ied_meets_cinecitto.html
  upload: ydc-interior-ied_meets_cinecitto.html

- url: /ydc-interior.html
  mime_type: text/html
  static_files: ydc-interior.html
  upload: ydc-interior.html

- url: /ydc-interior_design-unofficial.html
  mime_type: text/html
  static_files: ydc-interior_design-unofficial.html
  upload: ydc-interior_design-unofficial.html

- url: /ydc-lighting-design.html
  mime_type: text/html
  static_files: ydc-lighting-design.html
  upload: ydc-lighting-design.html

- url: /ydc-lighting-pixelight.html
  mime_type: text/html
  static_files: ydc-lighting-pixelight.html
  upload: ydc-lighting-pixelight.html

- url: /ydc-lighting.html
  mime_type: text/html
  static_files: ydc-lighting.html
  upload: ydc-lighting.html

- url: /ydc-lighting_design_monochromenature.html
  mime_type: text/html
  static_files: ydc-lighting_design_monochromenature.html
  upload: ydc-lighting_design_monochromenature.html

- url: /ydc-manifesto.html
  mime_type: text/html
  static_files: ydc-manifesto.html
  upload: ydc-manifesto.html

- url: /ydc-members.html
  mime_type: text/html
  static_files: ydc-members.html
  upload: ydc-members.html

- url: /ydc-news.html
  mime_type: text/html
  static_files: ydc-news.html
  upload: ydc-news.html

- url: /ydc-page_under_construction.html
  mime_type: text/html
  static_files: ydc-page_under_construction.html
  upload: ydc-page_under_construction.html

- url: /ydc-pictures.html
  mime_type: text/html
  static_files: ydc-pictures.html
  upload: ydc-pictures.html

- url: /ydc-product.html
  mime_type: text/html
  static_files: ydc-product.html
  upload: ydc-product.html

- url: /ydc-product_design-ciabattalibro.html
  mime_type: text/html
  static_files: ydc-product_design-ciabattalibro.html
  upload: ydc-product_design-ciabattalibro.html

- url: /ydc-product_design-dog_s_tent.html
  mime_type: text/html
  static_files: ydc-product_design-dog_s_tent.html
  upload: ydc-product_design-dog_s_tent.html

- url: /ydc-product_design-kubo.html
  mime_type: text/html
  static_files: ydc-product_design-kubo.html
  upload: ydc-product_design-kubo.html

libraries:
- name: webapp2
  version: "2.5.2"

非常感谢大家没有回答我,因为我必须独自完成:)我现在对自己更满意了:D