Generate an image tag with a Django static url in the view instead of the template
<p>I want to generate an image with a static url in a view, then render it in a template.  I use <code>mark_safe</code> so that the HTML won't be escaped.  However, it still doesn't render the image.  How do I generate the image tag in Python?</p>

<pre><code>from django.shortcuts import render
from django.utils.safestring import mark_safe

def check(request):
    html = mark_safe('&lt;img src="{% static "brand.png" %}" /&gt;')
    return render(request, "check.html", {"image": html})
</code></pre>

<p>Rendering it in a template:</p>

<pre class="lang-none prettyprint-override"><code>{{ image }}
</code></pre>

<p>renders the img tag without generating the url:</p>

<pre class="lang-html prettyprint-override"><code>&lt;img src="{% static "brand.png" %} /&gt;
</code></pre>