1
votes

i have the following main.py file:

 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 file:

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

handlers:

  • url: /images/(..(gif|png|jpg)) static_files: static/img/\1 upload: static/img/(..(gif|png|jpg))

  • url: /css/(..css) mime_type: text/css static_files: static/css/\1 upload: static/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 upload: static/(..html)

  • url: .* script: main.app

libraries:

  • name: webapp2 version: "2.5.2"

this is the list of directories and files .. so why i get 404 ??

enter image description here

if i write

  • url: /index.html

    mime_type: text/html

    static_files: index.html

    upload: index.html

it show me the index.html page but without images... this is pretty strange what is happening with regex of images?

1
A simple experiment would be to comment out the handler declaration for .*.htmlDave W. Smith
seems because there is no route mapping for /index.html.marcadian
try using /.*\.html for your handler's regexericmux
@DaveW.Smith if i comment out the html handeler it print me on the url tab : localhost:8080/index.html/index.html/index.html/index.html/… index.html.... a lot of index.html...T-student
@EricMuxagata see editsT-student

1 Answers

4
votes

well i solved like this:

 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"

thank you very much to everyone for NOT answering me because i had to make it alone :) i m more satisfied now of myself :D