Auto-run setup.py if the config database doesn't exist.

This commit is contained in:
Paresh More 2016-05-26 13:00:27 +01:00 committed by Dave Page
parent 6f2c8cfb31
commit 0dabbf3dad

View File

@ -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