Hard-coded static asset URL in template

Hard-coding static asset urls is brittle because the place the files are stored depends on the `STATICFILES_STORAGE` used - so if in prod the storage backend uploads to S3 or even renames the file then this hard-coded URL will break.

Using "{% static ... %}" solves that as it knows exactly where the files are stored.

If our GitHub code review bot spots this issue in your pull request it gives this advice:

django-doctorbotsuggested changes just now
template.html
1
+
<img src="/static/logo.png" />

Hard-coding static asset urls is brittle because the place the files are stored depends on the `STATICFILES_STORAGE` used - so if in prod the storage backend uploads to S3 or even renames the file then this hard-coded URL will break.

Using "{% static ... %}" solves that as it knows exactly where the files are stored.

Read more
Suggested changes
-
<img src="/static/logo.png" />
+
{% load static %}
+
<img src="{% static 'logo.png' %}" />
Commit suggestion
Update template.html

Instantly check if you have this issue for free

    Works with tools you use

    Read about how it works.