コード例 #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,
    )
コード例 #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)
コード例 #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)
コード例 #4
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
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)
コード例 #5
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def debug_url(path):
    hsh = hash_for_paths([path])
    url = reverse("django.views.static.serve", kwargs={"path": path})
    return "%s?devcachebuster=%s" % (url, hsh)
コード例 #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)