Reputation: 77
Here is part of settings.py
:
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
HTML template:
{% load staticfiles %}
...
<head>
<title>HelpDesk System</title>
<script scr="{% static "js/vendor/jquery.js" %}" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="{% static "css/foundation.css" %}">
<script scr="{% static "js/foundation.min.js" %}" type="text/javascript"></script>
</head>
<body>
<script>
$(document).ready(function() {
$(document).foundation();
});
</script>
...
</body>
Static folder tree:
Result:
Css file loads as expected, but js does't and error occurs: Can't find variable: $
Upvotes: 3
Views: 15119
Reputation: 13731
It looks like your script tags contain the wrong attribute for specifying the source.
<script src="{% static "js/vendor/jquery.js" %}" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="{% static "css/foundation.css" %}">
<script src="{% static "js/foundation.min.js" %}" type="text/javascript"></script>
Upvotes: 8