当前位置: 首页 > 工具软件 > staticfiles > 使用案例 >

You‘re using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.

咸承教
2023-12-01

错误

在Linux环境下通过pytho manage.py collectstatic --settings=settings.local命令收集静态资源的时候报错

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

解决方法

如果有多个配置文件,则在指定的settings.local文件中加入如下代码,或直接在settings.py文件中直接加入

STATIC_URL = '/static/' # 能够访问静态文件的URL路径
STATIC_ROOT = os.path.join(BASE_DIR,'static') 

STATIC_URL是Django能够访问静态文件的URL路径
STATIC_ROOT是collectstatic工具用来保存收集到的项目引用到任何静态文件的路径

 类似资料:

相关阅读

相关文章

相关问答