diff options
-rw-r--r-- | main/templatetags/cdn.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/main/templatetags/cdn.py b/main/templatetags/cdn.py index f290a524..ab5d881a 100644 --- a/main/templatetags/cdn.py +++ b/main/templatetags/cdn.py @@ -1,8 +1,10 @@ from django import template from django.conf import settings +from django.contrib.staticfiles.storage import staticfiles_storage register = template.Library() + @register.simple_tag def jquery(): version = '1.4.4' @@ -11,8 +13,8 @@ def jquery(): link = 'https://ajax.googleapis.com/ajax/libs/jquery/' \ '%s/jquery.min.js' % version else: - static_url = getattr(settings, 'STATIC_URL', '/static/') - link = '%sjquery-%s.min.js' % (static_url, version) + filename = 'jquery-%s.min.js' % version + link = staticfiles_storage.url(filename) return '<script type="text/javascript" src="%s"></script>' % link # vim: set ts=4 sw=4 et: |