1,django目录结构(需要用到的文件用红箭头标记):
2,首先在templates模版目录下创建login.html文件
3,将bootstrap导入到static/plugins目录下 PS:Bootstrap是Twitter推出的一个用于前端开发的开源工具包,有很丰富的前端各种案例
4,首先在templates下创建login.html登陆首页
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>登陆</title> <link href="http://www.likecs.com/static/plugins/bootstrap/css/bootstrap.css"></link> </head> <body> <div> <form action="/login/" method="post"> <div> <label for="inputEmail3">Email</label> <div> <input type="email" placeholder="Email"> </div> </div> <div> <label for="inputPassword3">Password</label> <div> <input type="password" placeholder="Password"> </div> </div> <div> <div> <button type="submit">Sign in</button> <span> {{ status }}</span> </div> </div> </form> </div> <script type="text/javascript" src="http://www.likecs.com/static/js/jquery-2.1.4.min.js"></script> <script type="text/javascript" src="http://www.likecs.com/static/plugins/bootstrap/js/bootstrap.js"></script> </body> </html>