Я разрабатываю приложения Django реагировать с помощью докера, но на моей странице администратора появляется ошибка ниже. Я использую nginx для прокси моего маршрута, чтобы отреагировать на бэкэнд клиента и django, а также admin. Но мой бэкэнд показывает такую ошибку, которая не обслуживает статические CSS-файлы.
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:3050/static/admin/css/base.css".
...
Кто-нибудь знает, как это исправить? Я пробовал эту ссылку или добавил include /etc/nginx/mime.types;
к моей конфигурации nginx, но вместо этого отображается ошибка 404. Ниже мой конф nginx. Я даже пытался удалить кеш браузера, но он тоже не работал. Пожалуйста, помогите
upstream client {
server client:3000;
}
upstream api {
server api:8000;
}
server {
listen 80;
include /etc/nginx/mime.types; ######Try added this but it shows 404 instead of the errors
location / {
proxy_pass http://client;
}
location /sockjs-node {
proxy_pass http://client;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location ~ ^/(static/|js|css) {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
proxy_pass http://client;
}
location ~ ^/(static/|pagedown|pagedown-extra|rest_framework|admin) {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
proxy_pass http://api;
}
location ~ ^/api {
# rewrite /api/(.*) /$1 break; # this is for chop off the /api/ urlpath
proxy_pass http://api;
}
location ~ ^/admin {
# rewrite /api/(.*) /$1 break;
proxy_pass http://api;
}
}
<!DOCTYPE html>
<html lang="ja-jp" >
<head>
<title>サイト管理 | Django サイト管理</title>
<link rel="stylesheet" type="text/css"
href="/static/admin/css/base.css">
<link rel="stylesheet" type="text/css"
href="/static/admin/css/dashboard.css">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" type="text/css"
href="/static/admin/css/responsive.css">
<meta name="robots" content="NONE,NOARCHIVE">
</head>
<body class=" dashboard"
data-admin-utc-offset="32400">
<!-- Container -->
<div id="container">
<!-- Header -->
<div id="header">
<div id="branding">
<h1 id="site-name"><a href="/admin/">Django 管理サイト</a></h1>
</div>