Django后台样式丢失django.core.exceptions.ImproperlyConfigured: You‘re using the staticfiles app without ha

django 3.0 部署nginx和uswsgi.ini后登录后台管理http://127.0.0.1/admin 样式失效

报错:django.core.exceptions.ImproperlyConfigured: You’re using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path
 

在setting.py 中设置

DEBUG = False  # 关闭debug模式
 
ALLOWED_HOSTS = ['*']

在setting最后添加

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR,'static')


然后在项目目录下,执行命令,yes就可以了

python manage.py collectstatic


样式重新恢复。

猜你喜欢

转载自blog.csdn.net/weixin_47649808/article/details/125949731