(重命名settings后) pycharm 高亮提示 unresolved template reference的解决

在优化完项目后,发现项目模板中以前正常识别的static突然无法识别了,pycharm 高亮提示 unresolved template reference(重命名settings后) pycharm 高亮提示 unresolved template reference的解决

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

 

# 设置静态文件访问
STATIC_URL = '/static/'
# STATIC_ROOT = os.path.join(BASE_DIR, 'static')

STATICFILES_DIRS = [
    os.path.join(BASE_DIR,'static'), os.path.join(BASE_DIR, 'media')

查看了Stack Overflow中https://*.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.

(重命名settings后) pycharm 高亮提示 unresolved template reference的解决

(重命名settings后) pycharm 高亮提示 unresolved template reference的解决

高亮没有了,看的爽多了!希望对踩到这个坑的兄弟有帮助!