title: django how to include javascript in template
body: <p>I'm starting a project and following the documentation I didn't succeed to include javascript.</p>
  
  <p>Here is my settings:</p>
  
  <pre><code>STATIC_URL = '/static/'
  
  STATICFILES_DIRS = (
      os.path.join(BASE_DIR, "static"),
  )
  
  STATIC_ROOT = '/static/'
  
  TEMPLATE_DIRS = (
      os.path.join(BASE_DIR, 'templates'),
  )
  </code></pre>
  
  <p>So I have a static folder create in my project with a javascript file.</p>
  
  <blockquote>
    <p>myproject/static/app.js</p>
  </blockquote>
  
  <p>my urls.py:</p>
  
  <pre><code>urlpatterns = [
      url(r'^$', 'app.views.home'),
      url(r'^admin/', include(admin.site.urls)),
  ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
  </code></pre>
  
  <p>and in my template:
  this is myproject/templates/base.html:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;head&gt;
    {% load static %}
    &lt;script src="{% static 'app.js' %}"&gt;&lt;/script&gt;   
    &lt;title&gt;Site&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;img src="{% static 'img.png' %}" alt="Mon image" /&gt;
    {% block content %}{% endblock %}
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My other template:</p>
  
  <pre><code>{% block content %}
      hello world
  {% endblock %}
  </code></pre>
  
  <p>I have the "hello world" on </p>
  
  <blockquote>
    <p><a href="http://127.0.0.1:8000/" rel="noreferrer">http://127.0.0.1:8000/</a></p>
  </blockquote>
  
  <p>but i do not have my image or script.</p>
  
  <p>I tried so many different things but I never succeed</p>