Django how to upload static file

Опубликовано: 05 Август 2026
на канале: Sachin Pawar
36
2

--------------------settings.py----

end of this file


STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'producthunt/static')
]

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

add this is in settings file template

'DIRS': ['project/static'],

----------------------------------create folder in main project (project/static )-
and upload any image in that folder

----------------------------------home.html-------------------------
{% load static %}
{% static 'image_name.jpg' %}