Reputation: 67
I am using Django and i want to import an image to my about.html file
Both the picture and the about.html are in the same file, see the picture down
i am trying to insert the image like this, but i get a broken picture icon
<img src="templates/WebApp/rolomatik_logo_crna_verzija.png"
Any suggestions please?
Upvotes: 0
Views: 1336
Reputation: 2257
You should create a folder static
in your app. Inside that you have to create another folder with name same as your app name. In your case it should be SmartApp/static/SmartApp/
and put your image in the folder.
After this use {% load static %}
at the top of your template,inside your <head>
tag. After this you can use the image like this:
<img src="{% static 'SmartApp/rolomatik_logo_crna_verzija.png' %}" >
Upvotes: 0
Reputation: 1258
You cannot insert an image in that way. You need to keep that in a static folder.
Create a folder named static
and place your image inside it.
Then use {% load static %}
at the top of your template.
Your img tag should look like this: <img src="{% static "rolomatik_logo_crna_verzija.png" %}" />
For more details refer: https://docs.djangoproject.com/en/1.11/howto/static-files/
Upvotes: 2