Here is my code:
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write(self.request.url)
def main():
settings = {"template_path": "html","static_path": "static"}
tornado.options.parse_command_line()
application = tornado.web.Application([
(r"/story/page1", MainHandler),
],**settings)
I want to get the string "/story/page1". how ?
You can get current url inside RequestHandler
using self.request.uri
:
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write(self.request.uri)