diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py index 7706a4e3a..ece79f788 100644 --- a/web/pgadmin/__init__.py +++ b/web/pgadmin/__init__.py @@ -201,6 +201,9 @@ def create_app(app_name=config.APP_NAME): from setup import do_upgrade do_upgrade(app, user_datastore, security, version) + # Load all available serve drivers + driver.init_app(app) + ########################################################################## # Load plugin modules ########################################################################## @@ -252,9 +255,6 @@ def create_app(app_name=config.APP_NAME): 'current_blueprint': current_blueprint } - # Load all available serve drivers - driver.init_app(app) - ########################################################################## # All done! ########################################################################## diff --git a/web/pgadmin/utils/driver/registry.py b/web/pgadmin/utils/driver/registry.py index 659aa76a0..466f9c6ee 100644 --- a/web/pgadmin/utils/driver/registry.py +++ b/web/pgadmin/utils/driver/registry.py @@ -46,7 +46,7 @@ class DriverRegistry(ABCMeta): - Use this function from init_app(...) to load all available drivers in the registry. """ - registry = dict() + registry = None drivers = dict() def __init__(cls, name, bases, d): @@ -76,7 +76,9 @@ class DriverRegistry(ABCMeta): @classmethod def load_drivers(cls): - DriverRegistry.registry = dict() + # Initialize the registry only if it has not yet been initialized + if DriverRegistry.registry is None: + DriverRegistry.registry = dict() from importlib import import_module from werkzeug.utils import find_modules