title: How do you import a js file using {% load staticfiles%} in a base html template
body: <p>Using Django {% load staticfiles %} I'm trying to load an app.js file in my base.html template.</p>
  
  <p>I've seen several questions on StackOverflow about this and I also tried to follow this tutorial: <a href="https://www.techiediaries.com/javascript-tutorial/" rel="nofollow noreferrer">https://www.techiediaries.com/javascript-tutorial/</a>  but no of them actually helped with my issue. </p>
  
  <p>It seems strange as well because on dev tools I see a 200 GET on the static/js/js.app and when I actually open the path the javascript is there.</p>
  
  <p>Additionally, when I put the js code in a  at the end of the body it seems to work. But I want to load the js from a file.</p>
  
  <p>Below is the latest that I've tried, but still no luck.</p>
  
  <p>base.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  {% load staticfiles %}
  
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
      &lt;meta name="description" content=""&gt;
      &lt;meta name="author" content=""&gt;
      &lt;link rel="icon" href="favicon.ico"&gt;
      &lt;link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet"&gt;
      &lt;link href="{% static 'js/app.js' %}" rel="stylesheet"&gt;
      &lt;link href="{% static 'css/main.css' %}" rel="stylesheet"&gt;
  
  
  &lt;body&gt;
  
  &lt;div class="container"&gt;
      {% block content %}
      {% endblock content %}
  &lt;/div&gt;
  
  
  &lt;!-- jquery --&gt;
  
  &lt;script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
          integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
          crossorigin="anonymous"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
          integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
          crossorigin="anonymous"&gt;&lt;/script&gt;
  &lt;script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
          integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
          crossorigin="anonymous"&gt;&lt;/script&gt;
  &lt;!-- jquery --&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Settings.py</p>
  
  <pre><code>STATIC_URL = '/static/'
  STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
  
  </code></pre>