From: Ben Darnell Date: Sat, 11 Jun 2011 22:09:05 +0000 (-0700) Subject: Serve sphinx docs from app engine X-Git-Tag: v2.0.0~20^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=678d2eb2a97f8eb9a8fad36233935f7dae8a0f78;p=thirdparty%2Ftornado.git Serve sphinx docs from app engine --- diff --git a/website/app.yaml b/website/app.yaml index 109663ba5..d0ee858a3 100644 --- a/website/app.yaml +++ b/website/app.yaml @@ -1,5 +1,5 @@ application: python-tornado -version: 1 +version: 2 runtime: python api_version: 1 @@ -21,5 +21,11 @@ handlers: static_files: static/favicon.ico upload: static/favicon.ico +- url: /documentation/reference/ + script: website.py + +- url: /documentation/reference + static_dir: sphinx/build/html + - url: /.* script: website.py diff --git a/website/templates/documentation.html b/website/templates/documentation.html deleted file mode 100644 index 8c2874087..000000000 --- a/website/templates/documentation.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Tornado Web Server Documentation{% end %} - -{% block headertitle %}

documentation

{% end %} - -{% block body %} - {{ markdown("documentation.txt", toc=True) }} -{% end %} diff --git a/website/templates/overview.html b/website/templates/overview.html new file mode 100644 index 000000000..bcaa022aa --- /dev/null +++ b/website/templates/overview.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block title %}Tornado Web Server Overview{% end %} + +{% block headertitle %}

overview

{% end %} + +{% block body %} + {{ markdown("overview.txt", toc=True) }} +{% end %} diff --git a/website/templates/documentation.txt b/website/templates/overview.txt similarity index 100% rename from website/templates/documentation.txt rename to website/templates/overview.txt diff --git a/website/website.py b/website/website.py index 39b7aed4c..32ec68493 100644 --- a/website/website.py +++ b/website/website.py @@ -24,9 +24,8 @@ import wsgiref.handlers class ContentHandler(tornado.web.RequestHandler): - def get(self, path): - paths = ("documentation", "index") - if not path: path = "index" + def get(self, path="index"): + paths = ("overview", "index") if path not in paths: raise tornado.web.HTTPError(404) self.render(path + ".html", markdown=self.markdown) @@ -51,12 +50,19 @@ settings = { "debug": os.environ.get("SERVER_SOFTWARE", "").startswith("Development/"), } application = tornado.wsgi.WSGIApplication([ - (r"/([a-z]*)", ContentHandler), + (r"/", ContentHandler), + (r"/(index)", ContentHandler), + (r"/documentation/(overview)", ContentHandler), (r"/static/tornado-0.1.tar.gz", tornado.web.RedirectHandler, dict(url="http://github.com/downloads/facebook/tornado/tornado-0.1.tar.gz")), (r"/static/tornado-0.2.tar.gz", tornado.web.RedirectHandler, dict(url="http://github.com/downloads/facebook/tornado/tornado-0.2.tar.gz")), + (r"/documentation/?", tornado.web.RedirectHandler, + dict(url="/documentation/overview")), + (r"/documentation/reference/?", tornado.web.RedirectHandler, + dict(url="/documentation/reference/index.html")), + ], **settings)