forked from mgckind/desaccess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice_limited.py
52 lines (42 loc) · 1.45 KB
/
service_limited.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import tornado.ioloop
"""Easyaccess Web application."""
import tornado.web
from tornado.options import define, options
from version import __version__
import Settings
define("port", default=8080, help="run on the given port", type=int)
class DownHandler(tornado.web.RequestHandler):
def get(self):
self.set_status(404)
self.render('limited.html', version=__version__, errormessage='Come back soon!', username='')
class MainHandler(tornado.web.RequestHandler):
def get(self):
#self.set_status(404)
self.render('limited.html', version=__version__, errormessage='Come back soon!', username='')
class Application(tornado.web.Application):
"""
The tornado application class
"""
def __init__(self):
handlers = [
(r"/", MainHandler),
(r"/easyweb/", MainHandler),
]
settings = {
"template_path": Settings.TEMPLATE_PATH,
"static_path": Settings.STATIC_PATH,
"debug": Settings.DEBUG,
"static_url_prefix": "/easyweb/static/",
"default_handler_class": DownHandler,
}
tornado.web.Application.__init__(self, handlers, **settings)
def main():
"""
The main function
"""
tornado.options.parse_command_line()
http_server = tornado.httpserver.HTTPServer(Application())
http_server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
if __name__ == "__main__":
main()