在我的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文件?
添加回答
舉報
0/150
提交
取消