简体   繁体   中英

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 ?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM