jquery打包在一个方便的django应用程序中,以加速新的应用程序和部署。
django-static-jquer的Python项目详细描述
JQuery2.1.4
要求
Django1.4或更高版本
安装
$ pip install django-static-jquery==2.1.4
设置
只需将'django.contrib.staticfiles'和'django_static_jquery'添加到 您的设置.py:
INSTALLED_APPS = ( # ... 'django.contrib.staticfiles', 'django_static_jquery', # ... )
参考djangostatic files 配置和部署静态文件的文档。
用法
您可以使用以下命令引用模板中的jquery:
{% load staticfiles %} {% static 'static_jquery/js/jquery.js' %}
管理模板自定义:
{% load staticfiles %} {% extends "admin/base_site.html" %} {% block extrahead %} <script type="text/javascript" src="{% static 'static_jquery/js/jquery.js' %}" /> {% endblock %}
静态文件:
static_jquery/js/jquery.js - JQuery - v2.1.4 static_jquery/js/jquery.min.js - JQuery (min) - v2.1.4 static_jquery/js/jquery.min.map - JQuery (map) - v2.1.4 static_jquery/js/jquery-migrate.js - jQuery Migrate - v1.2.1 static_jquery/js/jquery-migrate.min.js - jQuery Migrate (min) - v1.2.1