django项目部署到nginx+uwsgi服务器admin后台样式消失的问题

https://blog.csdn.net/qq_42571805/article/details/80862455

uwsgi为主要服务器,nginx为反向代理服务器
部署完成之后发现django后台admin访问时无样式
解决方法如下:
1.先打开django项目中settings.py文件(/blog/settings.py),添加STATIC_ROOT = ‘/home/blog/static/’
在这里插入图片描述
2.打开nginx配置文件nginx.conf,添加如下内容 (在http的大括号里)

3.运行python manage.py collectstatic,此命令是搜集静态文件的命令,搜集后的静态文件存放在/home/blog/static/中
4.重新启动uwsgi和nginx

Zo2
发布了20 篇原创文章 · 获赞 7 · 访问量 2304

猜你喜欢

转载自blog.csdn.net/weixin_43914692/article/details/88136307