-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.py
executable file
·48 lines (37 loc) · 1.45 KB
/
app.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
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
__author__ = "Tzury Bar Yochay <[email protected]>"
__version__ = "0.1"
import os, os.path, re
import tornado, tornado.httpserver, tornado.ioloop, tornado.options, tornado.web
from tornado.options import define, options
from httphandlers import *
from uimodules import *
from lib import netconfig
from lib.conf import appconfig
lan_host = appconfig.get()['net']['eth0']['addr'].split("/")[0]
define("port", default=5678, help="fsui port 5678", type=int)
class Application(tornado.web.Application):
def __init__(self):
settings = dict(
app_title=u"FSUI - FREESWITCH HTML5 INTERFACE",
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
ui_modules = {
"Header": HeaderModule,
"Footer": FooterModule,
"Title": TitleModule,
},
autoescape = None
)
tornado.web.Application.__init__(self, HTTP_HANDLERS, **settings)
def main():
# SET IP ADDRESSES FOR WAN/LAN INTERFACES
netconfig.configure()
os.system("/usr/local/bin/freeswitchd restart")
tornado.options.parse_command_line()
http_server = tornado.httpserver.HTTPServer(Application())
http_server.listen(options.port, lan_host)
tornado.ioloop.IOLoop.instance().start()
if __name__ == "__main__":
main()