Skip to content

Instantly share code, notes, and snippets.

@paulirish
Created January 7, 2011 03:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulirish/769051 to your computer and use it in GitHub Desktop.
Save paulirish/769051 to your computer and use it in GitHub Desktop.
# boilerplate server config for app engine
# from darktable aka Calvin Rein
# http://forrst.com/posts/Host_a_Static_HTML_Site_on_Google_App_Engine-BlA
# this is going here: https://github.com/paulirish/html5-boilerplate-server-configs/
application: your-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /apple-touch-icon\.png
mime_type: image/png
static_files: static/img/logo.png
upload: static/img/logo.png
- url: /favicon\.ico
mime_type: image/png
static_files: static/img/sm_logo.png
upload: static/img/sm_logo.png
- url: /(robots\.txt|crossdomain\.xml)
static_files: static/\1
upload: static/(robots\.txt|crossdomain\.xml)
- url: /img/(.*\.(gif|png|jpg))
static_files: static/img/\1
upload: static/img/(.*\.(gif|png|jpg))
- url: /swf/(.*\.swf)
static_files: static/swf/\1
upload: static/swf/(.*\.swf)
- 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: index.py
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
class IndexHandler(webapp.RequestHandler):
def get(self):
if self.request.url.ends('/'):
path = '%sindex.html'%self.request.url
else:
path = '%s/index.html'%self.request.url
self.redirect(path)
def post(self):
self.get()
def main():
application = webapp.WSGIApplication([('/.*', IndexHandler)],
debug=False)
util.run_wsgi_app(application)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment