def prod_url(paths, ext=None): if ext is None: ext = paths[0].rpartition('.')[-1] hsh = hash_for_paths(paths) return '//%s/%s/%s.%s' % ( conf.SIMPLESTATIC_CUSTOM_DOMAIN, conf.SIMPLESTATIC_COMPRESSED_DIR, hsh, ext, )
def compress_and_upload(self, template, paths, compress, ext): bucket = s3_bucket() name = "%s/%s.%s" % (conf.SIMPLESTATIC_COMPRESSED_DIR, hash_for_paths(paths), ext) key = bucket.get_key(name) if key is None: locked_print("Compressing %s from %s" % (ext, template)) compressed = compress(paths) locked_print("Uploading %s from %s" % (name, template)) key = bucket.new_key(name) set_content_type(key) key.set_contents_from_string(compressed, policy="public-read", replace=True)
def compress_and_upload(self, template, paths, compress, ext): bucket = s3_bucket() name = '%s/%s.%s' % ( conf.SIMPLESTATIC_COMPRESSED_DIR, hash_for_paths(paths), ext, ) key = bucket.get_key(name) if key is None: locked_print('Compressing %s from %s' % (ext, template)) compressed = compress(paths) locked_print('Uploading %s from %s' % (name, template)) key = bucket.new_key(name) set_content_type(key) key.set_contents_from_string(compressed, policy='public-read', replace=True)
def prod_url(paths, ext=None): if ext is None: ext = paths[0].rpartition(".")[-1] hsh = hash_for_paths(paths) return "//%s/%s/%s.%s" % (conf.SIMPLESTATIC_CUSTOM_DOMAIN, conf.SIMPLESTATIC_COMPRESSED_DIR, hsh, ext)
def debug_url(path): hsh = hash_for_paths([path]) url = reverse("django.views.static.serve", kwargs={"path": path}) return "%s?devcachebuster=%s" % (url, hsh)
def debug_url(path): hsh = hash_for_paths([path]) url = reverse('django.views.static.serve', kwargs={'path': path}) return '%s?devcachebuster=%s' % (url, hsh)