Django 5 use of static files with images

  Kiến thức lập trình

I´m trying to a picture to website with help of Django 5 and static files, the website its self is working with no error is diplayed in Django 5 but image is displayed

Has tried to read the documentation about static files and Django 5
Has tried to change path to location of jpg file
Website is running locally on my machine
HTML: <body> <img src="{% static 'imageshouse_of_functions_hawkeye.jpg' %}" alt=""> <div class="container"> <h1 id="main__title">Welcome to House of functions</h1>

In settings.pyyour text

`BASE_DIR = Path(__file__).resolve().parent.parent
TEMPLATE_DIR =Path(BASE_DIR, "templates")
STATIC_DIR =Path(BASE_DIR, "static")
print(STATIC_DIR)`

and
STATIC_URL = 'static/' STATIC_DIRS = [ STATIC_DIR / "static",

]

Example from my website

LEAVE A COMMENT