html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>登录</title>
<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="{{ url_for('static', filename='css/cms/signin.css') }}" rel="stylesheet">
</head>
<body>
<div class="container">
<form class="form-signin" method="post">
<h2 class="form-signin-heading">登录</h2>
<label for="inputEmail" class="sr-only">邮箱</label>
<input type="email" name="email" id="inputEmail" class="form-control" placeholder="邮箱" required autofocus>
<label for="inputPassword" class="sr-only">密码</label>
<input type="password" name="password" id="inputPassword" class="form-control" placeholder="密码" required>
<div class="checkbox">
<label>
<input type="checkbox" name="remember" value="1">记住我
</label>
</div>
<button class="btn btn-lg btn-primary btn-block" type="submit">点击登录</button>
</form>
</div>
</body>
</html>
css
body {
padding-top: 40px;
padding-bottom: 40px;
background-color: #eee;
}
.form-signin {
max- 330px;
padding: 15px;
margin: 0 auto;
}
.form-signin .form-signin-heading,
.form-signin .checkbox {
margin-bottom: 10px;
}
.form-signin .checkbox {
font-weight: normal;
}
.form-signin .form-control {
position: relative;
height: auto;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 10px;
font-size: 16px;
}
.form-signin .form-control:focus {
z-index: 2;
}
.form-signin input[type="email"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
视图
from flask import Blueprint, views, render_template
bp = Blueprint('cms', __name__, url_prefix='/cms')
class LoginView(views.MethodView):
def get(self):
return render_template('cms/cms_login.html')
def post(self):
pass
bp.add_url_rule('/login/', view_func=LoginView.as_view('login'))
访问