views:

198

answers:

1

How do I set index.html for the default root web page?

application: dfischerdna version: 1
 runtime: python api_version: 1

 handlers:

 - url: /   
   static_dir: static_files

This works great when the visitor types http://dfischerdna.appspot.com/index.html

However I would like that when he types this, the index.html web page would be displayed. http://dfischerdna.appspot.com/ -> goes to 404 page

+2  A: 

This might do the trick for you:

handlers:
- url: /
  static_files: path/to/index.html
  upload: local/path/to/index.html
- url: /(.+)
  static_files: path/to/\1
  upload: local/path/to/(.+)

The first url section will match the root URL and serve path/to/index.html. The second will match any path other than the root path, and will serve the file located under path/to that the request URI matches. For the URL http://yourapp.appspot.com/index.html it will serve path/to/index.html, and for a URL like http://yourapp.appspot.com/foo/bar.html it will serve path/to/foo/bar.html.

The upload directive tells GAE which local files to upload to serve as static files in your app instance.

Håvard S
With `static_files` directives, you also need to provide an `upload` directive to tell appcfg.py which files you want uploaded.
Wooble
how do i write the upload directive?
Alexandre H. Tremblay
@Wobble @unknown Right, I forgot. An example of the upload directive:handlers:- url: static_files: path/to/index.html static_files: path/to/index.html upload: local/path/to/index.html- url: static_files: path/to/(.+) static_files: path/to/\1 upload: local/path/to/(.+)
Håvard S