Skip to content

Use the STATIC_URL for static files to avoid redirection #4522

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

Merged
merged 3 commits into from
Aug 21, 2018

Conversation

davidfischer
Copy link
Contributor

This PR cleans up a few areas that were using MEDIA_URL but really should be using STATIC_URL after #4489. The old URL will work but will result in a redirect which slows things down and results in an extra hit.

@davidfischer davidfischer requested a review from a team August 14, 2018 21:34
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

Looks good. Just want to make sure we aren't breaking backwards compat, at least for now.

@@ -79,7 +76,7 @@ context = {
'html_theme': html_theme,
'current_version': "{{ version.verbose_name }}",
'version_slug': "{{ version.slug }}",
'MEDIA_URL': "{{ settings.MEDIA_URL }}",
Copy link
Member

Choose a reason for hiding this comment

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

We should probably continue to pass this along, in case anyone else is depending on it.

Copy link
Member

Choose a reason for hiding this comment

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

In case we keep passing it, may be a good idea to have a comment saying that it's not need and should be removed but it's kept for compatibility reasons.

BTW, how we "deprecate" and communicate something like this? It's too small to worth a blog post, I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll update this to keep the MEDIA_URL. I think we'll just keep it and detail any deprecation as part of https://docs.readthedocs.io/en/latest/design/theme-context.html.

- This may be removed when the new theme context is implemented
https://docs.readthedocs.io/en/latest/design/theme-context.html
@davidfischer
Copy link
Contributor Author

I re-added the MEDIA_URL back.

@davidfischer davidfischer merged commit 9ee283c into master Aug 21, 2018
@davidfischer davidfischer deleted the davidfischer/media-to-static-cleanup branch August 21, 2018 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants