openedx / openedx/openedx-platform
production settings overwrite staticfiles KEY_PREFIX cache setting defined in [lc]ms.yaml
@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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.