Load Static Files in Templates
A snippet showing how to load static files in Django templates.
{% load static %}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="{% static 'css/style.css' %}">
</head>
<body>
<img src="{% static 'images/logo.png' %}" alt="Logo">
<script src="{% static 'js/app.js' %}"></script>
</body>
</html>
Explanation:
-
Loads CSS, JS, and images from the
staticdirectory.
- Category Static & Media Files
- Total Views 841
- Last Modified 21 April, 2026
- Tags #static #templates #files #css-js
Previous snippet
Configure STATIC_URL and STATICFILES_DIRS
Next snippet