#!/usr/bin/env python
# _*_coding:utf-8 _*_
import tornado.ioloop
import tornado.web
application = tornado.web.Application([])
def decorator(view):
URL = view.URL
application.add_handlers('.*$', [(r'%s' % (URL), view)])
@decorator
class UserstHandler(tornado.web.RequestHandler):
URL = '/users'
def get(self, *args, **kwargs):
self.write("UserstHandler")
@decorator
class IndexHandler(tornado.web.RequestHandler):
URL = '/'
def get(self, *args, **kwargs):
self.write("IndexHandler")
if __name__ == "__main__":
application.listen(8000)
print("http://127.0.0.1:8000")
tornado.ioloop.IOLoop.instance().start()