zoukankan      html  css  js  c++  java
  • adminset 打开http://192.168.137.4:9000 跳转到/navi

    1. 程序主的url入口:
    
    [root@adminset adminset]# cat urls.py
    from django.conf.urls import include, url
    from django.contrib import admin
    from django.conf import settings
    from adminset.views import index
    
    urlpatterns = [
        url(r'^$', index,name='index'),
    	
    	
    http://192.168.137.4:9000  会访问adminset.views的index 方法
    
    [root@adminset adminset]# cat views.py
    #! /usr/bin/env python
    # -*- coding: utf-8 -*-
    
    from django.shortcuts import redirect
    
    
    def index(request):
        return redirect('/navi/')
    	
    
    # !/usr/bin/env python
    # -*- coding: utf-8 -*-
    import urllib2
    import urllib
    import cookielib
    import json
    import httplib
    import re
    import requests
    from lxml import etree
    import StringIO
    
    s = requests.session()
    print s.headers
    url = "https://licai.yingyinglicai.com/user/login.htm"
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0'
    }
    
    url = 'http://192.168.137.4:9000/'
    r = s.get(url, headers=headers)
    
    print '---------------------------------------------------------------------------------------------------------'
    print r.headers
    x=r.headers
    print r.content
    
    print x
    print type(x)
    for i in x:
     print i+'->'+x[i]
     
     C:Python27python.exe "C:Program FilesJetBrainsPyCharm Community Edition 2017.1.5helperspycharm\_jb_unittest_runner.py" --path D:/adminset/httprequest/testlocation.py
    Testing started at 10:37 ...
    Launching unittests with arguments python -m unittest discover -s D:/adminset/httprequest -p testlocation.py -t D:adminsethttprequest in D:adminsethttprequest
    {'Connection': 'keep-alive', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'User-Agent': 'python-requests/2.18.4'}
    ---------------------------------------------------------------------------------------------------------
    {'Content-Length': '4101', 'Set-Cookie': 'csrftoken=c52zVVgBuTNStkEEU9Bg0gdxxrAuWU1D0Wtkx0eBkxNBn6cnSZlZtlzLGC2lhG7y; expires=Fri, 08-Nov-2019 16:33:47 GMT; Max-Age=31449600; Path=/', 'Vary': 'Cookie', 'Server': 'WSGIServer/0.1 Python/2.7.15', 'Date': 'Fri, 09 Nov 2018 16:33:47 GMT', 'X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'text/html; charset=utf-8'}
    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <title>AdminSet Login</title>
      <!-- Tell the browser to be responsive to screen width -->
      <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
          <!-- Bootstrap 3.3.6 -->
      <link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css">
      <!-- Font Awesome 4.7.0 -->
      <link rel="stylesheet" href="/static/font-awesome/css/font-awesome.min.css">
      <!-- Ionicons 2.0.1-->
      <link rel="stylesheet" href="/static/ionicons/css/ionicons.min.css">
      <!-- Theme style -->
      <link rel="stylesheet" href="/static/dist/css/AdminLTE.min.css">
    
      <link rel="stylesheet" href="/static/dist/css/skins/skin-yellow-light.css">
      <link rel="stylesheet" href="/static/css/loading.css">
        <!-- REQUIRED JS SCRIPTS -->
    
    <!-- jQuery 2.2.3 -->
    <script src="/static/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <!-- Bootstrap 3.3.6 -->
    <script src="/static/bootstrap/js/bootstrap.min.js"></script>
    <!-- AdminLTE App -->
    <script src="/static/dist/js/app.min.js"></script>
    
    <!-- Optionally, you can add Slimscroll and FastClick plugins.
         Both of these plugins are recommended to enhance the
         user experience. Slimscroll is required when using the
         fixed layout. -->
        
            <script src="/static/plugins/iCheck/icheck.min.js"></script>
            <link rel="stylesheet" href="/static/plugins/iCheck/square/blue.css">
        
    
    
      <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
      <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
      <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
      <![endif]-->
    </head>
    <body class="hold-transition login-page">
    <div class="login-box">
      <div class="login-logo">
        <a href="/"><b>AdminSet</b></a>
      </div>
                  <div class="box box-info">
                <div class="box-header with-border">
                  <h3 class="box-title">用户认证</h3>
                </div>
                <!-- /.box-header -->
                <!-- form start -->
            <form class="form-horizontal" role="form" action="/accounts/login/" method="POST" >              <div class="box-body">
            <input type='hidden' name='csrfmiddlewaretoken' value='GKqOOFKbUt9fq0oGwPZEQZSkmgF8Jme0uBRzqKIbK79YkMWpuFJnj4eyvr7Z48kV' />
                
                    <div class="form-group">
                        <label class="control-label col-md-3">账 号</label>
                        <div class="col-md-8">
                            <input type="text" name="username" required class="form-control" id="id_username" />
                        </div>
                        <div class="col-md-offset-1 col-md-10">
                             
                        </div>
                    </div>
                
                    <div class="form-group">
                        <label class="control-label col-md-3">密 码</label>
                        <div class="col-md-8">
                            <input type="password" name="password" required class="form-control" id="id_password" />
                        </div>
                        <div class="col-md-offset-1 col-md-10">
                             
                        </div>
                    </div>
                
                  </div>
                  <!-- /.box-body -->
                  <div class="box-footer">
                      <input type="hidden" name="next" value="/navi/" />
                    <button style=" 340px;" type="submit" class="btn btn-info pull-right">登录</button>
                  </div>
                  <!-- /.box-footer -->
                </form>
              </div>
    
      <!-- /.login-logo -->
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
      <!-- /.login-box-body -->
    </div>
    <!-- /.login-box -->
    
    <!-- jQuery 2.2.3 -->
    
    <script>
      $(function () {
        $('input').iCheck({
          checkboxClass: 'icheckbox_square-blue',
          radioClass: 'iradio_square-blue',
          increaseArea: '20%' // optional
        });
      });
    </script>
    </body>
    </html>
    
    {'Content-Length': '4101', 'Set-Cookie': 'csrftoken=c52zVVgBuTNStkEEU9Bg0gdxxrAuWU1D0Wtkx0eBkxNBn6cnSZlZtlzLGC2lhG7y; expires=Fri, 08-Nov-2019 16:33:47 GMT; Max-Age=31449600; Path=/', 'Vary': 'Cookie', 'Server': 'WSGIServer/0.1 Python/2.7.15', 'Date': 'Fri, 09 Nov 2018 16:33:47 GMT', 'X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'text/html; charset=utf-8'}
    <class 'requests.structures.CaseInsensitiveDict'>
    Date->Fri, 09 Nov 2018 16:33:47 GMT
    Server->WSGIServer/0.1 Python/2.7.15
    Vary->Cookie
    X-Frame-Options->SAMEORIGIN
    Content-Type->text/html; charset=utf-8
    Content-Length->4101
    Set-Cookie->csrftoken=c52zVVgBuTNStkEEU9Bg0gdxxrAuWU1D0Wtkx0eBkxNBn6cnSZlZtlzLGC2lhG7y; expires=Fri, 08-Nov-2019 16:33:47 GMT; Max-Age=31449600; Path=/
    
    
    Ran 0 tests in 0.000s
    
    OK
    
    Process finished with exit code 0
    Empty test suite.
  • 相关阅读:
    IPC——信号量
    IPC——命名管道
    IPC——匿名管道
    IPC——信号
    管道和命名管道
    Oracle业务用户密码过期问题的解决
    Oracle获取数据库中的对象创建语句
    RAC禁用DRM特性
    配置Server Side TAF
    同一环境下新建Standby RAC库
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348992.html
Copyright © 2011-2022 走看看