title: Loading Javascript in Django using the static template tag
body: <p>I'm trying to following the instructions on <a href="https://docs.djangoproject.com/en/2.0/howto/static-files/" rel="nofollow noreferrer">https://docs.djangoproject.com/en/2.0/howto/static-files/</a>, but I'm running into unexpected results. I have a Django project with an app <code>dashboard</code> like so:</p>
  
  <pre><code>.
  ├── dashboard
  │   ├── __init__.py
  │   ├── admin.py
  │   ├── apps.py
  │   ├── migrations
  │   │   ├── 0001_initial.py
  │   │   ├── 0002_auto_20180227_2103.py
  │   │   ├── 0003_auto_20180227_2304.py
  │   │   └── __init__.py
  │   ├── models.py
  │   ├── static
  │   │   └── dashboard
  │   │       └── dashboard.js
  │   ├── templates
  │   │   └── dashboard
  │   │       ├── checkin_detail.html
  │   │       ├── checkin_form.html
  │   │       └── checkin_list.html
  │   ├── tests.py
  │   └── views.py
  ├── db.sqlite3
  ├── manage.py
  └── my_project
      ├── __init__.py
      ├── settings.py
      ├── urls.py
      └── wsgi.py
  </code></pre>
  
  <p>In my project's <code>settings.py</code>, the <code>STATIC_URL</code> is as it was created by <code>django-admin startproject</code>:</p>
  
  <pre><code># Static files (CSS, JavaScript, Images)
  # https://docs.djangoproject.com/en/2.0/howto/static-files/
  
  STATIC_URL = '/static/'
  </code></pre>
  
  <p>The <code>dashboard.js</code> file is a simple test script:</p>
  
  <pre><code>alert("Hello, world!");
  </code></pre>
  
  <p>I'm trying to use the Javascript in the <code>checkin_form.html</code> template like so:</p>
  
  <pre><code>{% load static %}
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src={% static "dashboard/dashboard.js" %}&gt;&lt;/script&gt;
  
  &lt;form action="" method="post"&gt;{% csrf_token %}
      {{ form.as_p }}
      &lt;input type="submit" value="Send message" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>My views inherit from Django's generic view classes:</p>
  
  <pre><code>from django.views import generic
  from .models import CheckIn
  
  
  class CheckInCreate(generic.CreateView):
      model = CheckIn
      fields = '__all__'
  
  
  class CheckInUpdate(generic.UpdateView):
      model = CheckIn
      fields = '__all__'
  </code></pre>
  
  <p>However, when I navigate to the URL rendered by that view, I don't see an alert with "Hello, world!". Can someone point out to me what is wrong with this configuration/implementation?</p>