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 static directory.
  • Category Static & Media Files
  • Total Views 841
  • Last Modified 21 April, 2026
  • Tags #static #templates #files #css-js
Never miss a story on Django.wiki

Subscribe for fresh tutorials, snippets, and updates.

By subscribing you agree to our Privacy Policy.