X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;ds=sidebyside;f=run.py;h=e1bbe5dafa4a43664f3b6839fe2659dc80ff0f8b;hb=2c3365447f36c26f2f55cc2a1b42a1e3ad0a8db9;hp=ef6aeab6b7fd56a93ed3c9e76a7b5bbfe532b68c;hpb=9c3ba57169fdc71d3ffefd4c7c20cae4e89f9c9c;p=plomtask
diff --git a/run.py b/run.py
index ef6aeab..e1bbe5d 100755
--- a/run.py
+++ b/run.py
@@ -2,21 +2,20 @@
"""Call this to start the application."""
from sys import exit as sys_exit
from os import environ
-from plomtask.misc import HandledException
+from plomtask.exceptions import HandledException
from plomtask.http import TaskHandler, TaskServer
from plomtask.db import DatabaseFile
-PATH_DB = environ.get('PATH_DB')
+PLOMTASK_DB_PATH = environ.get('PLOMTASK_DB_PATH')
HTTP_PORT = 8082
-TEMPLATES_DIR = 'templates'
DB_CREATION_ASK = 'Database file not found. Create? Y/n\n'
if __name__ == '__main__':
try:
- if not PATH_DB:
- raise HandledException('PATH_DB not set.')
- db_file = DatabaseFile(PATH_DB)
+ if not PLOMTASK_DB_PATH:
+ raise HandledException('PLOMTASK_DB_PATH not set.')
+ db_file = DatabaseFile(PLOMTASK_DB_PATH)
if not db_file.exists:
legal_yesses = {'y', 'yes', 'yes.', 'yes!'}
reply = input(DB_CREATION_ASK)
@@ -25,8 +24,7 @@ if __name__ == '__main__':
else:
print('Not recognizing reply as "yes".')
raise HandledException('Cannot run without database.')
- server = TaskServer(TEMPLATES_DIR, db_file,
- ('localhost', HTTP_PORT), TaskHandler)
+ server = TaskServer(db_file, ('localhost', HTTP_PORT), TaskHandler)
print(f'running at port {HTTP_PORT}')
try:
server.serve_forever()