Revert "Remove SelectiveFileSystemFolder finder workaround" (#4533)

* Revert "Remove SelectiveFileSystemFolder finder workaround"

* Remove `static` from selective finder
humitos/vcs/show-links
Anthony 2018-08-17 12:38:12 -06:00 committed by GitHub
parent f9965a1427
commit a89d4c1186
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
from django.contrib.staticfiles.finders import FileSystemFinder
class SelectiveFileSystemFinder(FileSystemFinder):
"""
Add user media paths in ``media/`` to ignore patterns.
This allows collectstatic inside ``media/`` without collecting all of the
paths that include user files
"""
def list(self, ignore_patterns):
ignore_patterns.extend(['epub', 'pdf', 'htmlzip', 'json', 'man'])
return super(SelectiveFileSystemFinder, self).list(ignore_patterns)

View File

@ -176,6 +176,10 @@ class CommunityBaseSettings(Settings):
os.path.join(SITE_ROOT, 'readthedocs', 'static'),
os.path.join(SITE_ROOT, 'media'),
]
STATICFILES_FINDERS = [
'readthedocs.core.static.SelectiveFileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
]
TEMPLATES = [
{