Django 2.1 - Adding images and static files - 5/14

preview_player
Показать описание
In this video we learn how to image and static files to a static folder and load them from the html files by using template tags.

Рекомендации по теме
Комментарии
Автор

Thanks for this tutorial, it ended an hour of error searching:)

ovbzvct
Автор

Your tutorials actually helped me with a project am working on. Thanks man

oluwadamilaretijani
Автор

once again i end up watching your video without knowing it was you, SUSCRIBED!

DanielMejia
Автор

If images residing in static file doesn't show up, open up settings.py and and add the following code

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static/")

souravnaskar
Автор

my image file is not loading in the browser, only small icon is coming after I am running the server. can you tell me the issue/ problem . why is it so?

shrutikhandelwal
Автор

really I am very thank full to you
I searched for this in internet for so long time .. but your explanation was the right one that solved my error.
and also your explanation is simple and very informative

ronsamgaming
Автор

could not able to display the image


{% load static %}


<html>
<head>
<title>Index</title>


</head>
<body>

<img src="{% static 'mysite/images/one.jpeg' %}">

<h1>{{ static }}</h1>
</body>
</html>

hemanthyernagula
Автор

this video helped clear up the issues I was having with figuring out what the django documentation page said thanks!

westcoastwarriorsarchive
Автор

Very clear and fast explanation ! Thank you :)

youssefbenhachem
Автор

<img src="{% static 'mrpash/images/pp.jpg' %}"> , i have this line for image file but the image doesn't load in the browser. A broker image icon is shown. I'm not sure what i'm doing wrong here. The path is correct and i have loaded the static folder

Update : I just restarted the server and the image loading perfectly fine. BTW very clear and informative videos

paritoshyadav
Автор

your explation was very simple and helpful thanks for that

ajayrathod
Автор

Thank you so much dude, ive been figuring out such a long time why my images didnt show up in django

hello-myot
Автор

Yes, it will work if your image file on the same page. if you are using extend block then it will display the error.

narendraverma
Автор

if it not works then add to settings.py:

STATIC_URL = '/static/'
STATICFILES_DIRS = [
BASE_DIR / "static",
]

MintySenpai
Автор

amazing video it helped me out so much

ethankoch
Автор

Thank you so much it was really helpful

zarinabano
Автор

How would I display all images simutaneously in a folder?

adil
Автор

Invalid block tag on line 9: 'static'images/cake.jpg''. Did you forget to register or load this tag?
1 {% load static %}
2 <!DOCTYPE html>
3 <html>
4 <head>
5 <title>Cake Page</title>
6 </head>
7 <body>
8 <h1>Hello, This is a picture of cake !</h1>
9 <img src="{% static'images/cake.jpg' %}" />
10
11 </body>
12 </html>

I am getting the error when I load my browser. Can anyone explain this

shivambansal
Автор

"GET HTTP/1.1"
This is the error I am getting whole loading images

ghulamrasoolhashmi