前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Python-Django 整合Django和jquery-easyui

Python-Django 整合Django和jquery-easyui

作者头像
授客
发布2019-09-11 15:40:55
1.6K0
发布2019-09-11 15:40:55
举报
文章被收录于专栏:授客的专栏

测试环境

win7 64

Python 3.4.0

jquery-easyui-1.5.1 下载地址1:http://www.jeasyui.com/download/index.php

下载地址2:http://pan.baidu.com/s/1i4TQK5n

jquery-1.5.1.min.js

下载地址:http://pan.baidu.com/s/1o78HO4y

环境配置

配置jquery-easyui

解压下载的jquery-easyui-1.5.1.zip,重命名解压后的文件目录为jquery-easyui,然后在放入应用的static目录下(例:F:\project\autotest\autotest\static\jquery-easyui)

把下载的jquery-1.5.1.min.js,放到jquery-easyui根目录下

测试配置是否成功

新建templates/autotest目录下分别新建testeasyui.html,index.html

testeasyui.html

<html>

<title>Accordion - jQuery EasyUI Demo</title>

{% load staticfiles %}

<script type="text/javascript" src="{% static 'jquery-easyui/jquery-1.5.1.min.js' %}"></script>

<link rel="stylesheet" type="text/css" href="{% static 'jquery-easyui/themes/default/easyui.css'%}" />

<link rel="stylesheet" type="text/css" href="{% static 'jquery-easyui/themes/icon.css'%}" />

<script type="text/javascript" src="{% static 'jquery-easyui/jquery.easyui.min.js'%}"></script>

<script type="text/javascript" src="{% static 'jquery-easyui/locale/easyui-lang-zh_CN.js' %}"></script>

<script type="text/javascript">

$(function(){

$.messager.confirm('标题内容' , '确认么?' ,function(r){

if(r){

alert('点击确认');

} else {

alert('点击取消');

}

});

$.messager.progress({

title: '我是进度条' ,

msg:'文本内容' ,

text: '正在加载..' ,

interval:1000

});

});

</script>

</html>

index.html

<html>

<body>

<p>home index</p>

</body>

</html>

Python-Django <wbr>整合Django和jquery-easyui
Python-Django <wbr>整合Django和jquery-easyui

加载静态文件夹,然后再引用完整的EasyUI引用如下: 编辑autotest/settings.py,添加带背景色内容

INSTALLED_APPS = [

'autotest.apps.AutotestConfig',

……

修改autotest/setting.py

from django.conf.urls import url from django.conf.urls import include from django.contrib import admin

urlpatterns = [ url(r'^autotest/', include('autotest.urls')), url(r'^admin/', admin.site.urls), url(r'^$', include('autotest.urls')), ]

编辑autotest\urls.py

__author__ = 'shouke' from django.conf.urls import url from . import views

urlpatterns = [ url('^testeasyui',views.testeasyui, name='testeasyui')

]

编辑autotest\views.py

from django.shortcuts import render #from django.http import HttpResponse def testeasyui(request): return render(request,'autotest/testeasyui.html')

def index(request): return render(request, 'autotest/index.html')

浏览器访问

Python-Django <wbr>整合Django和jquery-easyui
Python-Django <wbr>整合Django和jquery-easyui
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017-04-21 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档