At boot, GeoNode prints this warning:
[...]/lib/python3.10/site-packages/django/db/backends/utils.py:101: RuntimeWarning: Accessing the database during app initialization is discouraged. To fix this warning, avoid executing queries in AppConfig.ready() or when your app modules are imported.
warnings.warn(self.APPS_NOT_READY_WARNING_MSG, category=RuntimeWarning)
It is caused by the proxy module, which in the ready method calls
|
def run_setup_hooks(*args, **kwargs): |
|
proxy_urls_registry.initialize() |
which preloads some data:
|
for link in Link.objects.filter(resource__sourcetype="REMOTE", link_type__in=PROXIED_LINK_TYPES): |
Probably the initialize() call can be avoided, since the cache is checked and reloaded when it is accessed:
|
if ( |
|
self._last_registry_load is None |
|
or (now() - self._last_registry_load).days >= self._registry_reload_threshold |
|
): |
|
self.initialize() |
|
return self.proxy_allowed_hosts |
At boot, GeoNode prints this warning:
It is caused by the
proxymodule, which in thereadymethod callsgeonode/geonode/proxy/apps.py
Lines 25 to 26 in a82f6d0
which preloads some data:
geonode/geonode/proxy/utils.py
Line 26 in a82f6d0
Probably the
initialize()call can be avoided, since the cache is checked and reloaded when it is accessed:geonode/geonode/proxy/utils.py
Lines 58 to 63 in a82f6d0