diff --git a/core/backend/airshelf/urls.py b/core/backend/airshelf/urls.py index 0447e7e..fd948a9 100644 --- a/core/backend/airshelf/urls.py +++ b/core/backend/airshelf/urls.py @@ -5,7 +5,9 @@ from apps.common.views import health_check urlpatterns = [ - path("admin/", admin.site.urls), + # Django 自带后台挪到 /django-admin/:让前端 SPA 平台后台独占 /admin/*(否则 /admin/xx 刷新被 + # nginx 反代给 Django → 404)。Django admin 命名空间仍是 "admin",reverse 不受影响。 + path("django-admin/", admin.site.urls), path("api/health/", health_check, name="health-check"), path("api/auth/", include("apps.accounts.urls")), path("api/products/", include("apps.products.urls")), diff --git a/core/frontend/nginx.conf b/core/frontend/nginx.conf index 259698b..4863094 100644 --- a/core/frontend/nginx.conf +++ b/core/frontend/nginx.conf @@ -34,7 +34,8 @@ server { proxy_read_timeout 300s; } - location /admin/ { + # Django 自带后台(已从 /admin/ 挪到 /django-admin/);/admin/* 留给前端 SPA 平台后台,走底部 try_files 回落 index.html + location /django-admin/ { proxy_pass http://airshelf_api; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr;