Skip to content

Instantly share code, notes, and snippets.



Created Feb 10, 2015
What would you like to do?
how to do static files in django/s3
{% load static from versioned_static %}
<img src="{% static "img/transparentPixel.gif" %}">
<!-- all css files use relative paths to refer static content -->
CURRENT=${shell git rev-parse HEAD}
./ min
s3cmd sync proj/staticfiles/admin/ s3://
s3cmd sync proj/staticfiles/latest/ s3://${CURRENT}/
# custom template
from django import template
from django.conf import settings
register = template.Library()
def static(fragment):
return "%s%s/%s" % (
(settings.STATIC_URL if settings.STATIC_URL else "/static/"),
settings.COMMIT_ID, fragment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.