From bb1b6a86b22de1240646a16c0252648487175a2e Mon Sep 17 00:00:00 2001 From: Mo8it Date: Wed, 14 Jul 2021 04:26:18 +0200 Subject: [PATCH] Exception for importing routes and models while running testDB.py --- advlabdb/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/advlabdb/__init__.py b/advlabdb/__init__.py index c8a52a3..37e3bff 100644 --- a/advlabdb/__init__.py +++ b/advlabdb/__init__.py @@ -39,4 +39,9 @@ from advlabdb import models user_datastore = SQLAlchemyUserDatastore(db, models.User, models.Role) Security(app, user_datastore) -from advlabdb import routes, modelViews +try: + from advlabdb import routes, modelViews +except Exception as ex: + print( + "\nYou are probably initializing the database with a script. If not, then you have to worry about not being able to import in __init__.py!\n" + )