简体   繁体   中英

trouble trying to show an image from my static folder in a django template

im trying to show an image in my template if the profile haven't any picture. I have this code in my template

{% if not profileForm.avatar %}
   <img src="{% static 'img/empty-profile-picture.png' %}" alt="" />
{% endif %}

and i obtain that error

Template error:
In template /home/jaime/djcode/urgencias/templates/usuarios/profile_edit.html, error at line 68
   Invalid block tag: 'static', expected 'elif', 'else' o 'endif'

你有一个错字-关键字是static ,而不是satic

我也通过将丢失的{% load staticfiles %}放在子模板的开头来解决了这个问题。

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