pycharm 提示unresolved library 'staticfiles'的解决

在优化完项目后,发现项目模板中以前正常识别的{% load static %}突然无法识别了,提示Unresolved library 'static'

检查settings里的设置也没有问题。启动项目都没有问题,也没报错!

 

# 设置静态文件访问
STATIC_URL = '/static/'
#Django2.0以后,不需要加这个------ STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),) ----html页面引用可以用{% load static %}代替原来的{% staticfiles %}

查看了Stack Overflow中https://stackoverflow.com/questions/34679755/pycharm-unresolved-library-staticfiles,找到了答案;

解决方案:In my case this happened when PyCharm couldn't find settings.py file. This because I have - local_setting, prod_setting etc. So I go to File -> Settings -> Language & Framworks -> Django -> Settings and select appropriate file with setting of django project

posted @ 2020-03-16 00:04  香蕉都驼背  阅读(1012)  评论(0编辑  收藏  举报