[ Prev ] [ Index ] [ Next ]

Use

Created Dienstag 03 März 2020


Source


Use in template

Add somewhere at the top of a template:

{% load static %}


Link to the resource

{% static '<app name><path to resource>' %}


Examples


CSS
<link rel="stylesheet" type="text/css" href="{% static 'Inventory/css/main.css' %}" media="screen,projection" />


Picture
<img src="{% static "my_app/example.jpg" %}" alt="My image">


Attention

Create a <app name> subdirectory in the directory static for the app.