django+essyUI+mysql5.7完成第一个用户列表的增删改查,附上源码

第一次使用django框架写web,如有不对,请大家指正,开始

1.项目结构,一图千金,,哈哈

2.本地安装好mysql后,我的环境是python3 + django3+mysql5.7, django连接mysql需要安装 mysqlclient 1.4.6

我是在centos7下安装的python3,  再通过deactivate,新建一个虚拟环境,一个项目指定一个python环境,这样不会冲突

不会安装,可以参考我之前的文章:https://blog.csdn.net/kai402458953/article/details/104042695

3.正题,先编写用户的静态网页,myapp/templates/user.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户管理</title>
    <link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/color.css">
    <link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/demo/demo.css">
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="https://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
    <!--各种样式-->
    <style>
        .my-map{float:left; width: 100%; height: 600px;}
        .amap-container{height: 600px;}
        .text_title{margin: auto auto 10px 0; background: #fdfdfd; text-align:center}
    </style>
</head>
<body >
    <h1 class="text_title">用户信息</h1>
    <div class=" my-map">
        <table id="dg" title="用户信列表" class="easyui-datagrid" style="width:100%;height:600px;" url="/select_user/"
                toolbar="#toolbar" pagination="true"
                rownumbers="true" fitColumns="true" singleSelect="true">
            <thead>
                <tr>
                    <th field="user_name" width="30%">用户名</th>
                    <th field="user_pwd" width="30%">密码</th>
                    <th field="create_time" width="30%">操作时间</th>
                </tr>
            </thead>
        </table>
    </div>
    <div id="toolbar">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUsers()">新增用户</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editUsers()">编辑用户</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="dltUsers()">删除用户</a>
    </div>

    <div id="dlg" class="easyui-dialog" style="width:400px" closed="true" buttons="#dlg-buttons">
        <form id="fm" method="post" novalidate style="margin:0;padding:20px 50px">
            <div style="margin-bottom:20px;font-size:20px;border-bottom:1px solid #ccc">用户详情</div>
            <div style="margin-bottom:10px">
         
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值