pycharm 提示unresolved library 'staticfiles'的解决

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

检查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://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

猜你喜欢

转载自www.cnblogs.com/tuobei/p/12501270.html