Both pages pull their JavaScript from cdn.jsdelivr.net, which is unreachable behind an authenticating proxy — the page looked blank with no explanation. - override drf_spectacular/swagger_ui.html and redoc.html in project templates - if the library is missing or nothing rendered after 4 seconds, show a short message with a link to /api/docs/ (the offline reference) - drop the Google Fonts request from the ReDoc page (also blocked) - note the behaviour in docs/client-links.md
70 lines
2.6 KiB
HTML
70 lines
2.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="ru">
|
|
<head>
|
|
{% block head %}
|
|
<title>{{ title|default:"Swagger" }}</title>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
{% if favicon_href %}<link rel="icon" href="{{ favicon_href }}">{% endif %}
|
|
<link rel="stylesheet" href="{{ swagger_ui_css }}">
|
|
<style>
|
|
html { box-sizing: border-box; overflow-y: scroll; }
|
|
*, *:after, *:before { box-sizing: inherit; }
|
|
body { background: #fafafa; margin: 0;
|
|
font: 15px/1.55 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
|
|
color: #16212b; }
|
|
.api-fallback { display: none; max-width: 640px; margin: 64px auto; padding: 24px;
|
|
background: #fff; border: 1px solid #e6e8ec; border-radius: 12px; }
|
|
.api-fallback h1 { font-size: 20px; margin: 0 0 10px; }
|
|
.api-fallback p { color: #5b6b7a; margin: 0 0 10px; }
|
|
.api-fallback a { color: #1c4fd8; }
|
|
.api-fallback .btn { display: inline-block; margin-top: 6px; padding: 10px 18px;
|
|
background: #14161a; color: #fff; border-radius: 10px;
|
|
text-decoration: none; }
|
|
</style>
|
|
{% endblock head %}
|
|
</head>
|
|
<body>
|
|
{% block body %}
|
|
<div id="swagger-ui"></div>
|
|
|
|
<div class="api-fallback" id="api-fallback">
|
|
<h1>Swagger UI не загрузился</h1>
|
|
<p>Эта страница подгружает библиотеку с CDN, а он недоступен из вашей сети
|
|
(закрытый прокси или нет интернета).</p>
|
|
<p>Справочник по тем же методам открывается без интернета:</p>
|
|
<a class="btn" href="/api/docs/">Открыть справочник API</a>
|
|
</div>
|
|
|
|
<script src="{{ swagger_ui_bundle }}"></script>
|
|
<script src="{{ swagger_ui_standalone }}"></script>
|
|
{% if script_url %}
|
|
<script src="{{ script_url }}"></script>
|
|
{% else %}
|
|
<script>
|
|
{% include template_name_js %}
|
|
</script>
|
|
{% endif %}
|
|
<script>
|
|
(function () {
|
|
function showFallback() {
|
|
var node = document.getElementById('api-fallback');
|
|
if (node) { node.style.display = 'block'; }
|
|
}
|
|
|
|
if (typeof SwaggerUIBundle === 'undefined') {
|
|
showFallback();
|
|
}
|
|
|
|
setTimeout(function () {
|
|
var container = document.getElementById('swagger-ui');
|
|
if (!container || !container.querySelector('.swagger-ui')) {
|
|
showFallback();
|
|
}
|
|
}, 4000);
|
|
})();
|
|
</script>
|
|
{% endblock %}
|
|
</body>
|
|
</html>
|