我的 Django 1.3 项目中的 PyCharm(1.3 和 2 测试版)在检查我的脚本和样式包含的模板时会引发很多“未解决的静态引用”错误。
在一个过时的 PyCharm 文档中,我发现一个在我的情况下不起作用的小指南,因为我的静态文件分布在多个应用程序中。将我的静态目录添加到 STATICFILES_DIRS 也不起作用。
Dir structure (simplified):
app1/static/js/file.js
app1/static/css/file.css
app2/static/js/otherfile.js
app2/static/css/otherfile.css
templates/template.html
Template.html:
<script src="{{ STATIC_URL }}js/file.js"></script>
file.js 在我访问本地主机上的模板时解析,但在 PyCharm 中没有。
如何在 PyCharm 中解析静态文件?