Passing Python Data to JavaScript via Django
You can include <script> tags inside your .html templates, and then build your data structures however is convenient for you.  The template language isn't only for HTML, it can also do Javascript object literals.
And Paul is right: it might be best to use a json module to create a JSON string, then insert that string into the template.  That will handle the quoting issues best, and deal with deep structures with ease.
I'm using Django and Apache to serve webpages.  My JavaScript code currently includes a data object with values to be displayed in various HTML widgets based on the user's selection from a menu of choices.  I want to derive these data from a Python dictionary.  I think I know how to embed the JavaScript code in the HTML, but how do I embed the data object in that script (on the fly) so the script's functions can use it?
Put another way, I want to create a JavaScript object or array from a Python dictionary, then insert that object into the JavaScript code, and then insert that JavaScript code into the HTML.
I suppose this structure (e.g., data embedded in variables in the JavaScript code) is suboptimal, but as a newbie I don't know the alternatives.  I've seen write-ups of Django serialization functions, but these don't help me until I can get the data into my JavaScript code in the first place.
I'm not (yet) using a JavaScript library like jQuery.