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

Use collectstatic on media/, without collecting user files #4502

Merged
merged 3 commits into from Aug 14, 2018

Conversation

@agjohnson
Copy link
Contributor

@agjohnson agjohnson commented Aug 9, 2018

This doesn't change the STATICFILES_ROOT yet, in an attempt to avoid making any
breaking changes. This is a port of #4489 that we'll merge before azure
migration

agjohnson added 2 commits Aug 9, 2018
This doesn't change the STATICFILES_ROOT yet, in an attempt to avoid making any
breaking changes. This is a port of #4489 that we'll merge before azure
migration
Copy link
Contributor

@davidfischer davidfischer left a comment

This is close but I think we just need one change.

os.path.join(SITE_ROOT, 'media'),
]
STATICFILES_FINDERS = [
'readthedocs.core.static.SelectiveFileSystemFinder',
Copy link
Contributor

@davidfischer davidfischer Aug 10, 2018

I didn't know you could do that. Seems useful!

STATICFILES_DIRS = [os.path.join(SITE_ROOT, 'readthedocs', 'static')]
STATICFILES_DIRS = [
os.path.join(SITE_ROOT, 'readthedocs', 'static'),
os.path.join(SITE_ROOT, 'media'),
Copy link
Contributor

@davidfischer davidfischer Aug 10, 2018

This still seems a bit weird to me to collect files from a path (/media) and put them in a subdirectory (/media/static) but I guess it's ok with the SelectiveFileSystemFinder.

Copy link
Contributor Author

@agjohnson agjohnson Aug 10, 2018

Yeah agreed. I only worry that there are some deep parts requiring the media path, as this pattern goes back to early django I believe. If we run into any weirdness here, I think we can probably justify taking on work to separate static.

"""

def list(self, ignore_patterns):
ignore_patterns.extend(['epub', 'pdf', 'htmlzip', 'json', 'man'])
Copy link
Contributor

@davidfischer davidfischer Aug 10, 2018

We need static here (and hopefully there's no side effects). Otherwise when you run collectstatic multiple times, you end up with media/static/static/static/....

Copy link
Contributor Author

@agjohnson agjohnson Aug 10, 2018

I was on the fence whether to add this -- as we also (unfortunately) have a static/ in readthedocs/ that I was curious if we'd skip. I'll give a test here.

Copy link
Contributor

@davidfischer davidfischer Aug 10, 2018

And it looks like you can't do static/static...

Copy link
Contributor

@davidfischer davidfischer Aug 10, 2018

The other answer is we use --clear in dev at least.

Copy link
Contributor Author

@agjohnson agjohnson Aug 10, 2018

Yup, you're right, multiple runs makes a nest of static/ paths. I still see the files collected that I was worried about, so I think we're safe.

@ericholscher ericholscher merged commit 5f993a0 into master Aug 14, 2018
1 check passed
@stsewd stsewd deleted the agj/test-add-media-collection branch Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants