From 0dabbf3dad6e8e84f1a51c59ee4ed971ce01d1b9 Mon Sep 17 00:00:00 2001 From: Paresh More Date: Thu, 26 May 2016 13:00:27 +0100 Subject: [PATCH] Auto-run setup.py if the config database doesn't exist. --- web/pgAdmin4.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/web/pgAdmin4.py b/web/pgAdmin4.py index dea50ef46..4c9780db8 100644 --- a/web/pgAdmin4.py +++ b/web/pgAdmin4.py @@ -39,14 +39,11 @@ if config.SERVER_MODE is True: print("settings. Exiting...") sys.exit(1) -# Check if the database exists. If it does not, tell the user and exit. +# Check if the database exists. If it does not, create it. if not os.path.isfile(config.SQLITE_PATH): - print("The configuration database %s does not exist.\n" \ - % config.SQLITE_PATH) - print("Please run 'python %s' to create it.\nExiting..." % os.path.join( - os.path.dirname(os.path.realpath(__file__)), 'setup.py' - )) - sys.exit(1) + setupfile = os.path.join(os.path.dirname(os.path.realpath(__file__)), + 'setup.py') + execfile(setupfile) ########################################################################## # Server starup