Ejemplo n.º 1
0
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,
    )
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
def debug_url(path):
    hsh = hash_for_paths([path])
    url = reverse("django.views.static.serve", kwargs={"path": path})
    return "%s?devcachebuster=%s" % (url, hsh)
Ejemplo n.º 6
0
def debug_url(path):
    hsh = hash_for_paths([path])
    url = reverse('django.views.static.serve', kwargs={'path': path})
    return '%s?devcachebuster=%s' % (url, hsh)