-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.py
More file actions
29 lines (19 loc) · 876 Bytes
/
Copy pathapplication.py
File metadata and controls
29 lines (19 loc) · 876 Bytes
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
import os
from tornado.web import Application
from tornado.options import options
from urls import urlpatterns
class TornadoApplication(Application):
"""Application class initilazid one time."""
def __init__(self):
handlers = urlpatterns
settings = {}
settings['debug'] = options.debug
if options.static_path and os.path.exists(
os.path.abspath(options.static_path)):
settings['static_path'] = os.path.abspath(options.static_path)
settings['static_url_prefix'] = options.static_url_prefix
if options.template_path and os.path.exists(
os.path.abspath(options.template_path)):
settings['template_path'] = os.path.abspath(options.template_path)
settings['gzip'] = options.gzip
super(TornadoApplication, self).__init__(handlers, **settings)