1

I have all my static files in a folder called html in the root directory. I get the following error while trying to access the index.html in html folder:

-
INFO     2012-07-27 04:07:44,847 dev_appserver.py:2952] "GET /images/logo_footer.jpg HTTP/1.1" 404 -

Here is the folder structure:

root app directory

html directory

Handler code in handlers folder:

class MainHandler(webapp.RequestHandler):
  def get (self, q):
    if q is None:
      q = '../html/index.html'

    path = os.path.join (os.path.dirname (__file__), q)
    self.response.headers ['Content-Type'] = ContentType.HTML_TEXT
    self.response.out.write (template.render (path, {}))

Here is the url rule for images on app.yaml:

- url: /.*
  script: notify.app

# image files
- url: /(.*\.(bmp|gif|ico|jpeg|jpg|png))
  static_files: html/images/\1
  upload: html/images/(.*\.(bmp|gif|ico|jpeg|jpg|png))

Am I doing anything wrong here?

4

2 に答える 2

3

url : /.*app.yaml の画像ファイル セクションの後にセクションを移動する必要があります。これらは順番に処理され、/.*すべてに一致するため、2- url:行目は使用されません。

于 2012-07-27T08:06:50.887 に答える
0

「/images/logo_footer.jpg」と最初に一致する別のURLがあり、エラーが発生した可能性があります。

また、static_filesパスの\1が何であるかわからない。

于 2012-07-27T05:27:40.137 に答える