﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31497	get_static_prefix() as variable in a template doesn't work.	Thiago Krempser	nobody	"I'm using Django 3.0 and I tried to use this suggestion from the Django 3.0 documentation ([https://docs.djangoproject.com/en/3.0/ref/templates/builtins/#get-static-prefix]):

{{{
{% load static %}
{% tkrempser as STATIC_PREFIX %}

<img src=""{{ STATIC_PREFIX }}images/hi.jpg"" alt=""Hi!"">
<img src=""{{ STATIC_PREFIX }}images/hi2.jpg"" alt=""Hello!"">
}}}

But STATIC_PREFIX variable is empty and nothing is printed on template.

Using the other suggestion:

{{{
{% load static %}
<img src=""{% get_static_prefix %}images/hi.jpg"" alt=""Hi!"">
}}}

It works as expected.

"	Bug	closed	contrib.staticfiles	3.0	Normal	worksforme	get_static_prefix,static		Unreviewed	0	0	0	0	0	0
