This article mainly introduces how to use the Python Django framework and jQuery to implement the AJAX shopping cart page. for example, if you need RESTfulAPI in JSON format built in Django, refer
Integrate jquery in Django
First, static resources are usually put in the static folder:
static/ css/ djquery.css samples/ hello.css js/ jquery-1.7.1.min.js samples/ hello.js
Css and js both divide folders according to the application name (samples here). if there are many files, you can drag the molecular folder.
Django usually uses a template to display html, and we usually use an inherited template, so we need to share elements, such as global css, for jquery. the introduction of js is written to the base template, and the elements of the specific page are put into the specific template. This involves the issue of nesting. See the following example:
Base.html
{% Block title %} title {% endblock %}
{% Block styles %}
{% Endblock %} {% Block content %} content {% endblock %}