Skip to content

Commit a89d4c1

Browse files
authored
Revert "Remove SelectiveFileSystemFolder finder workaround" (#4533)
* Revert "Remove SelectiveFileSystemFolder finder workaround" * Remove `static` from selective finder
1 parent f9965a1 commit a89d4c1

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

readthedocs/core/static.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import division, print_function, unicode_literals
3+
4+
from django.contrib.staticfiles.finders import FileSystemFinder
5+
6+
7+
class SelectiveFileSystemFinder(FileSystemFinder):
8+
9+
"""
10+
Add user media paths in ``media/`` to ignore patterns.
11+
12+
This allows collectstatic inside ``media/`` without collecting all of the
13+
paths that include user files
14+
"""
15+
16+
def list(self, ignore_patterns):
17+
ignore_patterns.extend(['epub', 'pdf', 'htmlzip', 'json', 'man'])
18+
return super(SelectiveFileSystemFinder, self).list(ignore_patterns)

readthedocs/settings/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ def USE_PROMOS(self): # noqa
176176
os.path.join(SITE_ROOT, 'readthedocs', 'static'),
177177
os.path.join(SITE_ROOT, 'media'),
178178
]
179+
STATICFILES_FINDERS = [
180+
'readthedocs.core.static.SelectiveFileSystemFinder',
181+
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
182+
]
179183

180184
TEMPLATES = [
181185
{

0 commit comments

Comments
 (0)