Reputation: 91
I added the following lines in my settings.py file:
STATIC_URL = '/static/'
STATICFILES_DIR = [
os.path.join(BASE_DIR,"static"),
]
STATIC_ROOT = os.path.join(BASE_DIR,"static")
Then I edited my HTML file to use {% load static %}
and <img src="{% static 'static/myapp/images/ABC.png' %}" alt="">
, but still I am not able to see the ABC.png pic on my webpage. Can someone please help?
Screenshots of .py files:
Upvotes: 0
Views: 132
Reputation: 598
The issus is that you are incorrectly requesting the asset, use {% static 'myapp/images/ABC.png' %}
instead. I suppose that you have the following structure in your app:
myapp
static
myapp
images
ABC.png
templetes
views.py
...
As you can see, is not necessary to add the name of your statics directory. The path is relative to the static folder of any of your apps in your project.
Upvotes: 1