gamer
gamer

Reputation: 5873

django template image not showing with static

I have static structure:

static
    js
    img
    css
    my_files

In my template when I do <img src="{% static "{{ file.media_file }}" %}" I am not getting image but when I do <img src= "/static/{{file.media_file}}" I am getting images..

How can I get using {% static %} format ?

Upvotes: 0

Views: 82

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 600059

You don't use template tags inside template tags. You mean just:

<img src="{% static file.media_file %}">

Upvotes: 2

Related Questions