Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serving static html in Google app engine Python

I'm having trouble getting static .html pages loaded for my Python app. When I click on a link like index.html, I get a blank page and on the server log a 404 error. This is the same for other static .html files such as about.html.

The application works bar the static files. I've tried looking in numerous places, but I cannot seem to get the .html pages up. i.e.

INFO 2011-04-16 17:26:33,655 dev_appserver.py:3317] "GET / terms.html HTTP/1.1" 404 -

yaml:

application: quote
version: 1
runtime: python
api_version: 1

handlers:

- url: /index\.html
script: index.py

- url: /
script: index.py

- url: /(.*\.(html))
static_files: static/\1
upload: static/HTML/(.*\.(html))


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

- url: /css
static_dir: static/css

- url: /images
static_dir: static/images

- url: /js
static_dir: static/js

My static files are located in static/HTML and index.html is in the main folder.

I have also tried this, but it seems to make no difference at all:

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

- url: /css
  static_dir: static/css

- url: /images
  static_dir: static/images

 - url: /js
  static_dir: static/js

 - url: /(.*\.(html))
  static_files: static/\1
  upload: static/HTML/(.*\.(html))

 - url: /index\.html
  script: index.py

 - url: /
 script: index.py
like image 660
Androidian Avatar asked Apr 17 '11 14:04

Androidian


2 Answers

Keep your HandlerScripts below the Static Directory handling portion. IOW, just move this to the last.

- url: /index\.html
script: index.py

- url: /
script: index.py
like image 125
Senthil Kumaran Avatar answered Oct 05 '22 11:10

Senthil Kumaran


Put an /HTML in your static_files path:

- url: /(.*\.(html))
  static_files: static/HTML/\1
  upload: static/HTML/(.*\.(html))
like image 33
hyperslug Avatar answered Oct 05 '22 12:10

hyperslug