Static files in Django – Python

Static files in Django – Python

You need to create a static folder/Directory in the root of your project

├───core
│ ├───migrations
│ │ └───__pycache__
│ └───__pycache__
├───school
│ └───__pycache__
├───static
└───templates

 

settings.py

<div>
<div>STATIC_URL = '/static/'</div>
<div>STATICFILES_DIRS = [BASE_DIR/"static"]</div>
</div>

index.html file

{% load static %}
<div>
<div>&lt;img width="300" height="200" src="{% static 'urdu.png' %}" alt="My image"&gt;</div>
</div>
Tony BB
 

TonyBB is a Coach , marketer, hypnotist and a founder of RSKVF Production who specializes in providing simple, affordable, and easy to use solutions for Life.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: