I am trying to render a transparent image, from one of my views in django.
Here is the HTML -
// other html stuff
< img src="{% url 'minor_url_test' }" alt="Smiley face" height="1" width="1">
// other html stuff
urls.py -
url(r'^minor_image_url/$', 'minor_url_test', name='minor_url_test')
views.py -
def minor_url_test(request):
TRANSPARENT_1_PIXEL_GIF = "\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\xff\xff\xff\x00\x00\x00\x21\xf9\x04\x01\x00\x00\x00\x00\x2c\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3b"
import ipdb
ipdb.set_trace()
return HttpResponse(TRANSPARENT_1_PIXEL_GIF, content_type='image/gif')
I serve the html file, from a different view, all the html contents are served properly, but not the image. and the minor_url_test view is never hit.
What am I doing wrong?