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


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

index.html file

{% load static %}

<img width="300" height="200" src="{% static 'urdu.png' %}" alt="My image">

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: