-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
27 lines (21 loc) · 668 Bytes
/
Copy pathmain.py
File metadata and controls
27 lines (21 loc) · 668 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
"""
This is the main model. This is where the app will be run from.
"""
from twisted.internet.endpoints import TCP4ServerEndpoint
from twisted.internet import reactor
from protocol import LoggingFactory
from twisted.web import server
from webresource import WebRoot, WebLogs
LOGGER_TCP_PORT = 9898
LOGGER_WEB_PORT = 9900
# configure the logging endpoint
logging_endpoint = TCP4ServerEndpoint(reactor, LOGGER_TCP_PORT)
logging_endpoint.listen(LoggingFactory())
# configure the web endpoint
root = WebRoot()
logs = WebLogs()
root.putChild('logs', logs)
site = server.Site(root)
reactor.listenTCP(LOGGER_WEB_PORT, site)
if __name__ == '__main__':
reactor.run()