Files
netbox/netbox/templates/media_failure.html
Jason Novinger 9e13d89baa Fixes #20766: Prevent translation of code/commands in error templates
Use blocktrans 'with' clause to pass literal code/commands as variables,
preventing them from being translated. This fixes issues where commands
like 'manage.py collectstatic' were incorrectly translated to nonsensical
strings in non-English locales.

Updated templates:
- media_failure.html: manage.py collectstatic
- programming_error.html: python3 manage.py migrate, SELECT VERSION()
- import_error.html: requirements.txt, local_requirements.txt, pip freeze
2025-11-14 16:24:17 -06:00

62 lines
2.3 KiB
HTML

{% load static %}
{% load i18n %}
<!DOCTYPE html>
<html lang="en">
<head>
<title>{% trans "Static Media Failure - NetBox" %}</title>
<meta charset="UTF-8">
<style type="text/css">
body {
font-family: sans-serif;
}
li.tip {
line-height: 150%;
margin-bottom: 30px;
}
</style>
</head>
<body>
<div style="margin: auto; width: 800px">
<h1>{% trans "Static Media Failure" %}</h1>
<h3>
{% trans "The following static media file failed to load" %}:
<a href="{% static filename %}"><code style="color: red">{{ filename }}</code></a>
</h3>
<p>{% trans "Check the following" %}:</p>
<ul>
<li class="tip">
{% blocktrans trimmed with command="manage.py collectstatic" %}
<code>{{ command }}</code> was run during the most recent upgrade. This installs the most
recent iteration of each static file into the static root path.
{% endblocktrans %}
</li>
<li class="tip">
{% blocktrans trimmed with docs_url="https://docs.netbox.dev/en/stable/installation/" %}
The HTTP service (e.g. nginx or Apache) is configured to serve files from the <code>STATIC_ROOT</code>
path. Refer to <a href="{{ docs_url }}">the installation documentation</a> for further guidance.
{% endblocktrans %}
<ul>
{% if request.user.is_staff or request.user.is_superuser %}
<li><code>STATIC_ROOT: <strong>{{ settings.STATIC_ROOT }}</strong></code></li>
{% endif %}
<li><code>STATIC_URL: <strong>{{ settings.STATIC_URL }}</strong></code></li>
</ul>
</li>
<li class="tip">
{% blocktrans trimmed %}
The file <code>{{ filename }}</code> exists in the static root directory and is readable by the HTTP
server.
{% endblocktrans %}
</li>
</ul>
<p>
{% url 'home' as home_url %}
{% blocktrans trimmed %}
Click <a href="{{ home_url }}">here</a> to attempt loading NetBox again.
{% endblocktrans %}
</p>
</div>
</body>
</html>