title: Django: javascript needs to call a python script, what location do I put it in?
body: <p>I get really confused about django and file locations a lot, and I'm on django 1.10. But in my static/(django-proj-name)/js/ folder (just showing the way  I have my main.js file and I need to call a python script, in conjunction with the <a href="http://loopj.com/jquery-tokeninput/" rel="nofollow noreferrer">jquery tokeninput plugin</a>. Lets call the script <code>keywords.py</code></p>
  
  <p>This script is going to need to call all instances of a model, <code>Keyword</code>, so I need to be able to import from my models file.</p>
  
  <p>Im' a bit inexperienced with django, but from reviewing some of the projects I've seen over the summer I was startinng to believe that including the line, <code>from (django-proj-name).models import *</code> was the main way to import from models. This at least works for all of the files that I have in my /management/commands/ folder.</p>
  
  <p>But i tried putting <code>keywords.py</code> in my static folder just because I know at the very least I can use the <code>{% static %}</code> template tag to find the file in html. I ran the file without manage.</p>
  
  <pre><code>Traceback (most recent call last):
    File "../../management/commands/import_statements.py", line 5, in &lt;module&gt;
      from gtr_site.models import *
    ImportError: No module named gtr_site.models
  </code></pre>
  
  <p>Though I have the same importation line, again, in /management/commands/. And that doesn't cause any problems.</p>
  
  <p>So I didn't put the file in the "correct" file location... I didn't put keywords.py in a place where</p>
  
  <ol>
  <li><p>I know how to import from my models.py file from the keywords.py script's location</p></li>
  <li><p>My javascript file can find it and run it without crashing. This script needs to be able to successfully import from models.</p></li>
  </ol>
  
  <p>so where am I supposed to put this script, or how can I specify a location for it?</p>