-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.py
32 lines (27 loc) · 974 Bytes
/
main.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
'''
Settings for Tornado app go here
'''
import os
from tornado.httpserver import HTTPServer
from tornado.options import define, options
from tornado.web import Application,StaticFileHandler
from tornado.ioloop import IOLoop
from ri5c.views import GraphView
define('port', default=8000, help='port to listen on')
def main():
"""Construct and serve the tornado application."""
cwd = os.getcwd() # static files
port = int(os.environ.get("PORT", 8000))
path = os.path.join(cwd, "paper") # Path to dl file
app = Application([
(r'/', GraphView),
# Static files, repeat for other file names
(r'/(.*\.js)', StaticFileHandler, {"path": cwd} ),
(r'/download/(barojas_v193\.pdf)', StaticFileHandler, {'path': path} ), # Static serving file
])
http_server = HTTPServer(app)
http_server.listen(port)
print('RI5C is listening on port:%i' % port)
IOLoop.current().start()
if __name__ == "__main__":
main()