Skip to content

Instantly share code, notes, and snippets.

@ysimonson
Last active February 18, 2016 20:24
Show Gist options
  • Save ysimonson/7120798 to your computer and use it in GitHub Desktop.
Save ysimonson/7120798 to your computer and use it in GitHub Desktop.
Tornado decorator to make an endpoint prerenderable for search engine crawlers
# This has been turned into a full-fledged repo:
# https://github.com/dailymuse/torender
@ysimonson
Copy link
Author

@fransv

import tornado.ioloop
import tornado.web
from prerender import prerenderable

class MainHandler(tornado.web.RequestHandler):
    @prerenderable
    def get(self):
        self.write("Hello, world")

application = tornado.web.Application([
    (r"/", MainHandler),
], prerender_token="...")

if __name__ == "__main__":
    application.listen(8888)
    tornado.ioloop.IOLoop.current().start()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment