Skip to content

chore: remove deprecated DEFAULT_FILE_STORAGE and STATICFILES_STORAGE… #37002

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wgu-ram-chandra
Copy link
Contributor

@wgu-ram-chandra wgu-ram-chandra commented Jul 9, 2025

Description

This PR refactors the code to replace the deprecated DEFAULT_FILE_STORAGE and STATICFILES_STORAGE settings with the more flexible and recommended STORAGES = {} pattern.

Key changes:

  • Replaced DEFAULT_FILE_STORAGE with the new STORAGES['default'] setting.
  • Replaced STATICFILES_STORAGE with the new STORAGES['staticfiles'] setting.
  • Updated all relevant configurations and documentation to reflect these changes.

Settings Flow Diagram

To better illustrate how the settings flow between files and the changes made, I've created a diagram outlining the relationship between the key settings. Below is a visual representation of the flow:
image

Tests Performed

  1. pytest: Ran tests across multiple modules, including lms, cms, openedx, common, and xmodule. No errors related to settings were encountered.

  2. File Upload/Download:

    • Uploaded and downloaded course structures and various small files.
    • Verified that file persistence and integrity are maintained without issues.
  3. Manage.py Commands:

    • Executed common Django management commands such as:

      • python3 manage.py lms runserver
      • python3 manage.py lms migrate
      • python3 manage.py lms print_setting STORAGES
      • python3 manage.py lms dump_settings
    • No issues or unexpected behavior were observed during command execution.

Note:

Filed an issue in tutor-contrib-s3 to track updating the plugin for Django 4.2+ compatibility with the new STORAGES setting: link to issue

This PR does not block on that, but it’s good to have this documented for future reference.

@wgu-ram-chandra wgu-ram-chandra requested review from feanil, kdmccormick and a team as code owners July 9, 2025 18:39
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 9, 2025
@openedx-webhooks
Copy link

Thanks for the pull request, @wgu-ram-chandra!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@@ -222,7 +222,6 @@ def get_env_setting(setting):
# we need to run asset collection twice, once for local disk and once for S3.
# Once we have migrated to service assets off S3, then we can convert this back to
# managed by the yaml file contents
STATICFILES_STORAGE = os.environ.get('STATICFILES_STORAGE', STATICFILES_STORAGE)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are not expecting "STATICFILES_STORAGE" setting from the environment, this line can be removed. But little guidance on how to approach this greatly helps. Thanks!

@wgu-ram-chandra
Copy link
Contributor Author

@holaontiveros, thanks for pointing that out! I realized that I mistakenly applied autopep8 to the .yml files as well, which caused the formatting issue. I'll fix it!

@wgu-ram-chandra wgu-ram-chandra force-pushed the issue-36744-storage-settings branch from 9e61aa3 to fe30e7d Compare July 9, 2025 23:58
@awais786 awais786 added the create-sandbox open-craft-grove should create a sandbox environment from this PR label Jul 10, 2025
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

1 similar comment
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@wgu-ram-chandra wgu-ram-chandra added create-sandbox open-craft-grove should create a sandbox environment from this PR and removed create-sandbox open-craft-grove should create a sandbox environment from this PR labels Jul 11, 2025
@wgu-ram-chandra wgu-ram-chandra force-pushed the issue-36744-storage-settings branch from cdfd345 to 0f55c9e Compare July 11, 2025 18:13
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@wgu-ram-chandra wgu-ram-chandra added the mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). label Jul 14, 2025
@wgu-ram-chandra
Copy link
Contributor Author

wgu-ram-chandra commented Jul 15, 2025

image

The patch that might be involved: https://github.com/hastexo/tutor-contrib-s3/blob/main/tutors3/patches/openedx-common-settings

I'm still seeing the same issue on the sandbox, I'll share an update once it's resolved!

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Jul 15, 2025
@kdmccormick kdmccormick self-assigned this Aug 1, 2025
@feanil feanil self-assigned this Aug 1, 2025
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

Copy link
Contributor

@feanil feanil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wgu-ram-chandra what's the impact on downstream production systems, if someone has DEFAULT_FILE_STORAGE or STATICFILES_STORAGE settings defined in their YAML config, I believe those will now get ignored? Is that right?

@wgu-ram-chandra
Copy link
Contributor Author

Hi @feanil, sorry for the delay getting back, I was tied up with other tasks.

To clarify your question, if someone has DEFAULT_FILE_STORAGE defined in their YAML config, it will still be honored in the LMS and CMS openstack.py and production.py environments. This is because those settings use a pattern like:

AUTH_TOKENS.get("DEFAULT_FILE_STORAGE")

Which is then used to populate:

STORAGES["default"]["BACKEND"]

So the config flow looks like:

YAML config → AUTH_TOKENS["DEFAULT_FILE_STORAGE"]STORAGES["default"]["BACKEND"]

Therefore, those values will not be ignored, they’re still explicitly read and mapped to the new STORAGES setting, so backward compatibility is maintained in these cases.

However, outside of this pattern, will now be ignored

Do you think we should shift even the openstack.py / production.py usage to expect STORAGES["default"]["BACKEND"] directly from the YAML, rather than routing it through AUTH_TOKENS["DEFAULT_FILE_STORAGE"]?

Looking forward to your thoughts!

@feanil
Copy link
Contributor

feanil commented Aug 8, 2025

Thanks Ram, no I think that's great, not breaking existing config but updating the internal structure to be what Django 5.2 needs makes sense to me.

@wgu-ram-chandra
Copy link
Contributor Author

Awesome! I’ll update the PR shortly.

@wgu-ram-chandra wgu-ram-chandra requested a review from a team as a code owner August 8, 2025 17:29
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@awais786
Copy link
Contributor

awais786 commented Aug 9, 2025

@wgu-ram-chandra
Copy link
Contributor Author

@awais786 sure thing, I’m already working on that. Thank you for pointing it out.

@wgu-ram-chandra wgu-ram-chandra force-pushed the issue-36744-storage-settings branch 2 times, most recently from 10bb02b to 9881c95 Compare August 12, 2025 19:36
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@wgu-ram-chandra wgu-ram-chandra force-pushed the issue-36744-storage-settings branch 2 times, most recently from 8139962 to d2ba473 Compare August 12, 2025 19:52
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@wgu-ram-chandra wgu-ram-chandra force-pushed the issue-36744-storage-settings branch from d2ba473 to 3fae860 Compare August 16, 2025 18:56
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-sandbox open-craft-grove should create a sandbox environment from this PR mao-onboarding Reviewing this will help onboard devs from an Axim mission-aligned organization (MAO). open-source-contribution PR author is not from Axim or 2U
Projects
Status: Waiting on Author
Development

Successfully merging this pull request may close these issues.

DEFAULT_FILE_STORAGE setting is deprecated
7 participants