Skip to content

deprecated-static-library

Added in NEXT_DJANGOFMT_VERSION · Related issues · View source

Fix is always available.

What it does

Checks for {% load %} tags that load the staticfiles or admin_static template libraries.

Why is this bad?

Both libraries are aliases of static, deprecated in Django 2.1 and removed in Django 3.0. Loading them gains nothing over static, and fails outright from Django 3.0 on.

The rule is version-gated: it reports nothing until lint.target-version names Django 2.1 or newer.

Example

{% load staticfiles %}
<img src="{% static 'logo.png' %}" alt="Logo" width="64" height="64">

Use instead:

{% load static %}
<img src="{% static 'logo.png' %}" alt="Logo" width="64" height="64">

Options

References