【发布时间】:2021-12-02 15:52:00
【问题描述】:
我正在使用 nginx 和 gunicorn 部署 django。当我访问该网站时,我收到以下错误。
open() "/home/x/aroundu/core/static/static/rest_framework/js/default.js" failed
它访问静态文件错误,因为路径应该是这样的
open() "/home/x/aroundu/core/core/static/rest_framework/js/default.js" failed
server {
listen 80;
location /static/ {
alias /home/x/aroundu/core/core/static/;
}
location /media/ {
alias /home/x/aroundu/core/media/;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = "/media/"
【问题讨论】:
标签: django nginx django-rest-framework gunicorn