---
title: '{% get_static_prefix %}'
description: puts STATIC\_URL into the template.
date: '2026-08-21'
categories:
  - Template Tag
  - Utility
canonical: https://www.djangotemplatetagsandfilters.com/tags/get_static_prefix/
doc_link: https://docs.djangoproject.com/en/6.1/ref/templates/builtins/#get-static-prefix
---

# {% get_static_prefix %}

puts STATIC\_URL into the template.

## Documentation

Puts `STATIC_URL` into the template. Reach for it only where `{% static %}` cannot go — building a path in JavaScript, for instance.

### Template

```django
{% load static %}
<script>const STATIC = "{% get_static_prefix %}";</script>
```

### Result

```django
<script>const STATIC = "/static/";</script>
```

Use `as` to hold it in a variable when you need it more than once.
