zoukankan      html  css  js  c++  java
  • django 后台数据直接交给页面

    
    <html>
    <head>
        <title>运维平台</title>
        <link rel="stylesheet" type="text/css" href="/static/Css/Monitor/addmqmonitor.css">
        <link rel="stylesheet" type="text/css" href="/static/Css/Public/header.css">
        <link rel="stylesheet" type="text/css" href="/static/Css/Public/menu.css">
    </head>
    <body>
        <include file="Public:header"/>
        <div class="content">
            <include file="Public:menu"/>
            <div class="con fl">
                <form id="condition" action="/addmqmonitor/" method="post">
                    
                    <label class="condition">应用</label><input type="text" name="app" class="equipment_sz">
                    <label class="condition">队列管理器</label><input type="text" name="qmgr" class="equipment_sz">
                    <label class="condition">通道名称</label><input type="text" name="channel" class="equipment_sz">
                                    <br />
                    <label class="condition">IPADDR</label><input type="text" name="ipaddr" class="equipment_sz">
                    <label class="condition">PORT</label><input type="text" name="port" class="equipment_sz">
                    <label class="condition">队列监控阈值</label><input type="text" name="depth" class="equipment_sz">
                    <label class="condition">是否监控</label><input type="text" name="flag" class="equipment_sz">
                                    <br />
                    <input type="submit" value="设备添加" class="equipment_add_btn">
                </form>
            </div>
        </div>
    </body>
    <script type="text/javascript" src="/static/Js/jquery-2.2.2.min.js"></script>
    <!-- <script type="text/javascript" src="/static/Js/Equipment/addEquipment.js"></script> -->
    </html>
    
    
    def addmqmonitor(req):
       print req.get_full_path()
       app= req.POST['app']
       qmgr= req.POST['qmgr']
       channel= req.POST['channel']
       ipaddr= req.POST['ipaddr']
       port= req.POST['port']
       depth= req.POST['depth']
       flag= req.POST['flag']
       conn= MySQLdb.connect(
            host='127.0.0.1',
            port = 3306,
            user='root',
            passwd='1234567',
            db ='DEVOPS',
            charset="UTF8"
            )
       cursor = conn.cursor()
       sql = "insert into mon_mq(name,qmgr,channel,ipaddr,port,depth,flag) values('%s','%s','%s','%s','%s','%s','%s')" % (app,qmgr,channel,ipaddr,port,depth,flag)
       cursor.execute(sql)
       conn.commit()
       a = cursor.execute("select name,qmgr,channel,ipaddr,port,flag from  mon_mq" )
       info = cursor.fetchall()
       print info
       print type(info)
       return render(req,'listmqinfo.html',{'info':info})
    
    
    [root@yyjk templates]#cat listmqinfo.html 
    <html>  
    <head>  
        <title>运维平台</title>  
        <link rel="stylesheet" type="text/css" href="/static/Css/Equipment/modifyBtn.css">  
        <link rel="stylesheet" type="text/css" href="/static/Css/Public/header.css">  
        <link rel="stylesheet" type="text/css" href="/static/Css/Public/menu.css">  
    </head>  
    <table border="10">
    {% for x in info %}  
    <tr>
    <th>{{x.0}}</th>
    <th>{{x.1}}</th>
    <td>{{x.2}}</td>
    <td>{{x.3}}</td>
    <td>{{x.4}}</td>
    <td>{{x.5}}</td>
    </tr>
    {% endfor %}  
    </table>
    
  • 相关阅读:
    ajax初步(1) fly
    jquery(1) fly
    图片轮播 fly
    仿慕课网教程html+css页面前段时间学习总结(1) fly
    jquery(3)常用方法 fly
    再次遭遇VS设计视图假死
    注册表导致VS2008切换设计视图假死
    BUUCTF PWN 铁人三项(第五赛区)_2018_rop
    buuctf re [FlareOn4]IgniteMe
    buuctf re [WUSTCTF2020]level3
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349007.html
Copyright © 2011-2022 走看看