misc: remove unused settings.CDNS (#64434)

This commit is contained in:
Frédéric Péters 2022-04-21 14:37:47 +02:00
parent b97be713d9
commit 114cac011c
2 changed files with 0 additions and 29 deletions

View File

@ -21,11 +21,6 @@ You should add gadjo.finders.XStaticFinder to STATICFILES_FINDERS,
STATICFILES_FINDERS = global_settings.STATICFILES_FINDERS + \
('gadjo.finders.XStaticFinder',)
There is a CDNS settings, that can contain a list of (cdn name, protocol)
tuples; for example:
CDNS = [('google', 'https')]
Additional static files
------------------------

View File

@ -15,32 +15,8 @@ register = template.Library()
@register.simple_tag
def xstatic(modname, filename):
try:
# list of tuples of the form (cdnname, protocol)
cdns = settings.CDNS
except AttributeError:
cdns = []
if settings.DEBUG:
filename = filename.replace('.min.', '.')
if cdns:
modname = str(modname.replace('-', '_'))
pkg = __import__('xstatic.pkg', fromlist=[modname])
mod = getattr(pkg, modname)
for cdnname, protocol in cdns:
try:
base_url = XStatic(mod, provider=cdnname, protocol=protocol).base_url
except KeyError:
continue
if isinstance(base_url, str):
# base_url is often a str
return base_url + '/' + filename
else:
# But it also can be a dict (which maps relative paths to
# full urls) (this happens with jquery CDN)
if filename in base_url:
return base_url.get(filename)
return settings.STATIC_URL + 'xstatic/' + filename