Reputation: 167
I'm having a lot of trouble getting all my static files to serve up. In my settings.py
, I have:
STATIC_URL = '/static/'
I'm using Django 1.6, and according to the official documentation https://docs.djangoproject.com/en/dev/howto/static-files/
Since I have debug=True
, this should suffice.
Then in my templates:
<link type="text/javascript" href="{% static 'jquery-1.11.1.js' %}" />
<link type="text/javascript" href="{% static 'jquery-1.11.1.min.js' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'bootstrap.min.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'jumbotron.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'custom.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'simple-sidebar.css' %}" />
All the CSS works fine. When I load my page, looking in Chrome's developer tools, they're coming from /static
, and I have all these files stored in the same dir. But the .js
files are not loading at all. They work fine if I link to the CDN.
Upvotes: 2
Views: 159
Reputation: 19945
What is link in
<link type="text/javascript" href="{% static 'jquery-1.11.1.min.js' %}" />
It should be
<script type="text/javascript" src="{% static 'jquery-1.11.1.min.js' %}"></script>
Upvotes: 1
Reputation: 26766
As I said in the comments, with <script>
tags, they shouldn't be self-closing so
<script type="text/javascript" src="{% static 'jquery-1.11.1.min.js' %}"></script>
note the <script ...></script>
instead of <script .../>
This is probably why your subsequent link tags aren't being processed properly
Upvotes: 2