django - 找不到管理员中 nginx ubuntu 服务器上的 Django 静态文件
问题描述
我已经在带有 nginx 网络服务器的 ubuntu 服务器上设置了我的 django 项目。在我的 django settings.py 文件中我设置:
STATIC_URL = '/static/'
STATIC_ROOT = '/static/images/'
STATICFILES_DIRS = [
'/var/www/core/frontend/static',
'/.venv/lib/python3.6/site-packages/django/contrib/admin/static',
]
嗯,在我的 nginx.conf 文件中我写:
server {
listen 80 default_server;
listen [::]:80 default_server;
}
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location /static/ {
alias /var/www/core/frontend/static/;
}
location / {
proxy_pass http://127.0.0.1:8000;
}
但是当我打开我的项目的管理部分时,我收到很多关于未找到 css 和 js 的 404 错误。
我必须在哪里实现我的代码才能正确管理静态管理文件?
非常感谢提前
解决方案
推荐阅读
- c# - 检查和清除 .NET MemoryCache。RAM不断增加
- c# - 将 JSON 属性反序列化为 C# 列表
- django - Django / Blender / Celery / Channels
- ipfs - 如何检查是给定的
是否已经完全下载? - javascript - 如何使用 javascript 在本地网络中查找设备?
- javascript - 测试在一个简单的函数(jest + vue)上失败。它说该函数没有被调用,但实际上 console.log 显示反对
- azure-api-management - 如何将 API Management Developer 门户 URL 重定向到网关 URL?
- javascript - 过滤 KendoGrid 中的多列(复选框和普通文本)
- python - 如何在字符组之间的边界处拆分字符串
- reactjs - react 中的 createLegacyRoot 是什么?