Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you need to render an image read a bit here <a href="http://www.djangobook.com/en/1.0/chapter11/" rel="noreferrer">http://www.djangobook.com/en/1.0/chapter11/</a> and use your version of the following code:</p> <p>For django version &lt;= 1.5:</p> <pre><code>from django.http import HttpResponse def my_image(request): image_data = open("/path/to/my/image.png", "rb").read() return HttpResponse(image_data, mimetype="image/png") </code></pre> <p>For django 1.5+ <code>mimetype</code> was replaced by <code>content_type</code>(so happy I'm not working with django anymore):</p> <pre><code>from django.http import HttpResponse def my_image(request): image_data = open("/path/to/my/image.png", "rb").read() return HttpResponse(image_data, content_type="image/png") </code></pre> <p>Also there's <a href="https://stackoverflow.com/questions/3003146/best-way-to-write-an-image-to-a-django-httpresponse/15832328">a better way</a> of doing things!</p> <p>Else, if you need a efficient template engine use Jinja2</p> <p>Else, if you are using Django's templating system, from my knowledge you don't need to define STATIC_URL as it is served to your templates by the "static" context preprocessor:</p> <pre><code>TEMPLATE_CONTEXT_PROCESSORS = ( 'django.contrib.auth.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n', 'django.core.context_processors.static', 'django.core.context_processors.media', 'django.core.context_processors.request', 'django.contrib.messages.context_processors.messages', ) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload