【发布时间】:2017-12-06 19:13:48
【问题描述】:
server {
listen 80;
server_name 13.xx.xx.xxx;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/ubuntu/studykarma/django-react-redux-base/src/;
}
location / {
include proxy_params;
include /etc/nginx/mime.types;
proxy_pass http://unix:/home/ubuntu/studykarma/django-react-redux-base/src/djangoreactredux.sock;
}
}
我的 nginx 配置文件
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static_root')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static_dist'),
)
我的设置.py
我的静态文件在 static_dist 文件夹中,我的 reactjs 代码在静态中 文件夹。
我的静态文件没有加载并给我 404, 如果我将路径更改为 /static_dist/ 那么我也会得到空内容。
我正在使用这个模板:https://github.com/Seedstars/django-react-redux-base
【问题讨论】:
-
我希望
location /static/与您的设置中的STATIC_ROOT相同。您是否运行collectstatic将文件复制到静态根目录?
标签: python django reactjs nginx wsgi