Skip to content

Instantly share code, notes, and snippets.

@amitu

amitu/Makefile

Created Feb 10, 2015
Embed
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}
sync:
./build.sh min
s3cmd sync proj/staticfiles/admin/ s3://static.proj.com/admin/
s3cmd sync proj/staticfiles/latest/ s3://static.proj.com/${CURRENT}/
# custom template
from django import template
from django.conf import settings
register = template.Library()
@register.simple_tag
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.