在我的settings.py中,我已经将staticfiles_dirs设置为
STATICFILES_DIRS = (
os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'static')).replace('\\','/')
)
在文件夹myproject / static中,我有一个名为jquery-1.10.0.js的文件。我试图像这样在我的应用程序模板中加载文件
{% load static %}
<script type="text/javascript" src="{% static "jquery-1.10.0.js" %}"></script>
但是我无法从模板中访问jquery函数,如果我转到{% static "jquery-1.10.0.js" %}返回的URL /static/jquery-1.10.0.js,则会看到一个页面,指出发生服务器错误。请与管理员联系。
如何从模板中访问jquery文件?
相关分类