bowenpay/wechat-spider

uwsgi+nginx部署,网页无法加载到static文件

zhiweio opened this issue · 5 comments

您好,很感谢你的项目
然后有个问题,我部署到生产使用的时候,发现网站的static文件无法加载,用的nginx+uwsgi,用的事例的nginx.conf文件改的nginx配置,,我用试了单独用uwsgi部署,同样无法加载static文件,我想是不是django里的settings需要改,我没接触过django,所以不是很了解,我google了一些方法,包括django官方文档的howto static-files,依然无法解决,请问下您是如何部署到生产的

部署到生产环境的时候,需要执行命令:python manage.py collectstatic 。
才会将所有静态文件都copy到 wechat-spider/static/ 目录下

你好,我试了collectstatic,再用uwsgi部署发现依然没有样式文件加载
404
static source
如图,很奇怪,不知道哪里出错

1 看看你的 nginx的配置 的路径
2 collectstatic后js css文件都拷贝到哪个文件夹了
3 nginx 记得重启或者reload

如果还有问题,发出来我看看

@yijingping 你好,我在mac上部署测试了下,
change
把这出^去掉,发现正常了
再在centos上同样部署时依旧不行,后面有空我再试下,找出原因然后完善一下部署文档
表示很感谢

Gaolz commented

@zhiwei1996 I met the same question like yours. The solution is that change the user to 'your-own-username' in /etc/nginx/nginx.conf. And reload nginx