home · contact · privacy
Re-structure whole code into more package-typical file modularity.
[plomtask] / run.py
1 #!/usr/bin/env python3
2 """Call this to start the application."""
3 from sys import exit as sys_exit
4 from plomtask.misc import HandledException
5 from plomtask.http import TaskHandler, TaskServer
6
7 HTTP_PORT = 8082
8
9
10 if __name__ == '__main__':
11     try:
12         server = TaskServer(('localhost', HTTP_PORT), TaskHandler)
13         print(f'running at port {HTTP_PORT}')
14         try:
15             server.serve_forever()
16         except KeyboardInterrupt:
17             print('aborting due to keyboard interrupt')
18         server.server_close()
19     except HandledException as e:
20         print(f'Aborting due to: {e}')
21         sys_exit(1)