title: Best way to get template variables from an external js file
body: <p>This is what I am currently doing to transfer a django template variable to a JS variable:</p>
  
  <pre><code>&lt;input type="hidden" id="django_var" value="{{variable}}" /&gt;
  ...
  var unique_var = $('#django_var').val();
  </code></pre>
  
  <p>Is there a more straightforward way to do this in the template, something that would work outside of forms as well? Thank you.</p>
  
  <p><strong>Update</strong>: the js variable will be an external file to the template, and thus won't be able to directly call the django template vars.</p>