My logo doesn't work in Django project: Code bellow:
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Главная</title>
{% load static %}
<img src="{% static 'media/logo.svg' %}" alt="My logo">
</head>
<body>
</body>
<footer>
</footer>
</html>
settings.py:
STATIC_URL = 'static/'
When i try yo open yje console it takes: Failed to load resource: the server responded with a status of 404 (Not Found) Logo is in a static/media/logo.svg
CodePudding user response:
The static folder should be at the same level as your templates' folder, and inside the static folder create a new folder for your images you can name the folder anything, save your image inside the folder,
Make sure that Django's STATICFILES_DIRS setting is correctly configured in your settings file. It should contain the path to your static folder.
or make sure you run collect static management command to copy the files to your Static_root folder