Skip to content

Instantly share code, notes, and snippets.

View Pettles's full-sized avatar

Pettles

  • Australia
View GitHub Profile
@Pettles
Pettles / staticencoder.py
Last active November 14, 2020 16:41 — forked from goldhand/staticencoder.py
Django template tag for encoding images in base64 and rendering with server
from django import template
from django.contrib.staticfiles.finders import find as find_static_file
from django.conf import settings
register = template.Library()
@register.simple_tag
def encode_static(path, encoding='base64', file_type='image'):
"""