openedx / openedx/openedx-platform

production settings overwrite staticfiles KEY_PREFIX cache setting defined in [lc]ms.yaml

Open
#37,378 2 comments 1 reaction 1 assignee View on GitHub

@feanil is already working on this.

Since Oct 3, 2025.

Dominant language
Python
Stars
8.2k
Forks
4.4k
Avg merge
6d 18h
Merged PRs (30d)
42

Description

Given a setting defined in the CACHES dictionary in lms.yaml (and similarly in cms.yaml) as in the following example:

...
  staticfiles:
    BACKEND: django.core.cache.backends.locmem.LocMemCache
    KEY_PREFIX: staticfiles_lms
    LOCATION: staticfiles_lms
...

The value of CACHES['staticfiles']['KEY_PREFIX'] is overwritten regardless of whether the EDX_PLATFORM_REVISION variable is defined with a meaningful value:
https://github.com/openedx/edx-platform/blob/430aed041d768f8c15156f9ff746f73f5bd79719/lms/envs/production.py#L158

I don't understand the relationship between the staticfiles cache configuration and the EDX_PLATFORM_REVISION variable, but this behavior is particularly problematic with settings for a shared cache backend like memcached because requires a python settings file which overwrites this hardwired KEY_PREFIX definition, unless the EDX_PLATFORM_REVISION is also defined in a meaningful way for staticfiles cache for lms & cms through the REVISION_CFG file.

For example, in the tutor environment, the variable EDX_PLATFORM_REVISION has the (permanent) default value of "release".

Maybe the value definition of CACHES['staticfiles']['KEY_PREFIX'] must be verified before the overwriting, to allow the CACHES dictionary be defined entirely through configuration files. I believe that this change aligns with the goal of Django settings simplification.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.