Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move CACHES import into function scope to prevent side effects. #9561

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion kolibri/utils/main.py
Expand Up @@ -25,7 +25,6 @@
from kolibri.core.upgrade import matches_version
from kolibri.core.upgrade import run_upgrades
from kolibri.core.utils.cache import process_cache
from kolibri.deployment.default.cache import CACHES
from kolibri.deployment.default.sqlite_db_names import ADDITIONAL_SQLITE_DATABASES
from kolibri.plugins.utils import autoremove_unavailable_plugins
from kolibri.plugins.utils import check_plugin_config_file_location
Expand Down Expand Up @@ -225,6 +224,10 @@ def _upgrades_before_django_setup(updated, version):


def _post_django_initialization():
# Import here to prevent the module level access to Kolibri options
# which causes premature registration of Kolibri plugins.
from kolibri.deployment.default.cache import CACHES

if "process_cache" in CACHES: # usually it means not using redis
if "DatabaseCache" not in CACHES["process_cache"]["BACKEND"]:
try:
Expand Down