home · contact · privacy
Add testing of Day sorting.
[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 TEMPLATES_DIR = 'templates'
9
10
11 if __name__ == '__main__':
12     try:
13         server = TaskServer(TEMPLATES_DIR,
14                             ('localhost', HTTP_PORT), TaskHandler)
15         print(f'running at port {HTTP_PORT}')
16         try:
17             server.serve_forever()
18         except KeyboardInterrupt:
19             print('aborting due to keyboard interrupt')
20         server.server_close()
21     except HandledException as e:
22         print(f'Aborting due to: {e}')
23         sys_exit(1)