home
·
contact
·
privacy
projects
/
plomtask
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactor updates of relations tables.
[plomtask]
/
run.py
diff --git
a/run.py
b/run.py
index ef6aeab6b7fd56a93ed3c9e76a7b5bbfe532b68c..e1bbe5dafa4a43664f3b6839fe2659dc80ff0f8b 100755
(executable)
--- 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
"""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
from plomtask.http import TaskHandler, TaskServer
from plomtask.db import DatabaseFile
-P
ATH_DB = environ.get('PATH_DB
')
+P
LOMTASK_DB_PATH = environ.get('PLOMTASK_DB_PATH
')
HTTP_PORT = 8082
HTTP_PORT = 8082
-TEMPLATES_DIR = 'templates'
DB_CREATION_ASK = 'Database file not found. Create? Y/n\n'
if __name__ == '__main__':
try:
DB_CREATION_ASK = 'Database file not found. Create? Y/n\n'
if __name__ == '__main__':
try:
- if not P
ATH_DB
:
- raise HandledException('P
ATH_DB
not set.')
- db_file = DatabaseFile(P
ATH_DB
)
+ if not P
LOMTASK_DB_PATH
:
+ raise HandledException('P
LOMTASK_DB_PATH
not set.')
+ db_file = DatabaseFile(P
LOMTASK_DB_PATH
)
if not db_file.exists:
legal_yesses = {'y', 'yes', 'yes.', 'yes!'}
reply = input(DB_CREATION_ASK)
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.')
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()
print(f'running at port {HTTP_PORT}')
try:
server.serve_forever()