diff --git a/app/classes/shared/models.py b/app/classes/shared/models.py index ef4e20c5..33a12b98 100644 --- a/app/classes/shared/models.py +++ b/app/classes/shared/models.py @@ -43,6 +43,7 @@ class Users(BaseModel): class Meta: table_name = "users" + class Audit_Log(BaseModel): audit_id = AutoField() created = DateTimeField(default=datetime.datetime.now) @@ -53,7 +54,6 @@ class Audit_Log(BaseModel): log_msg = TextField(default='') - class Host_Stats(BaseModel): time = DateTimeField(default=datetime.datetime.now) boot_time = CharField(default="") @@ -167,7 +167,8 @@ class db_builder: @staticmethod def default_settings(): - + logger.info("Fresh Install Detected - Creating Default Settings") + console.info("Fresh Install Detected - Creating Default Settings") default_data = helper.find_default_password() username = default_data.get("username", 'admin') @@ -185,9 +186,12 @@ class db_builder: @staticmethod def is_fresh_install(): - if helper.check_file_exists(helper.db_path): + try: + user = Users.get_by_id(1) return False - return True + except: + return True + pass class db_shortcuts: diff --git a/main.py b/main.py index 388f08ab..108abefc 100644 --- a/main.py +++ b/main.py @@ -82,7 +82,9 @@ if __name__ == '__main__': helper.create_session_file(ignore=args.ignore) # do our installer stuff - if not installer.is_fresh_install(): + fresh_install = installer.is_fresh_install() + + if fresh_install: installer.create_tables() installer.default_settings()