-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserve.py
More file actions
34 lines (24 loc) · 859 Bytes
/
serve.py
File metadata and controls
34 lines (24 loc) · 859 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
30
31
32
33
34
# -*- coding: utf-8 -*-
import tornado.httpserver
import tornado.ioloop
import tornado.template
import tornado.web
from raven.contrib.tornado import AsyncSentryClient
from tornado.options import define, options, parse_command_line
from app import settings
from app.urls import url_patterns
define("port", default=8888, help="port", type=int)
class CustomApplication(tornado.web.Application):
def __init__(self):
tornado.web.Application.__init__(self, url_patterns, **settings.application_settings)
self.sentry_client = AsyncSentryClient(settings.DSN)
def make_app():
return CustomApplication()
def main():
parse_command_line()
app = make_app()
http_server = tornado.httpserver.HTTPServer(app)
http_server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
if __name__ == "__main__":
main()