码迷,mamicode.com
首页 > 编程语言 > 详细

python编写简单的html登陆页面(1)

时间:2017-06-09 20:29:25      阅读:304      评论:0      收藏:0      [点我收藏+]

标签:name   type   user   cti   页面   dex   username   line   pytho   

1  html 打开调式效果如下

 

技术分享

技术分享

2  用python后台编写

# coding:utf-8
# 从同一个位置导入多个工具,
# 这些工具之间可以用逗号隔开,同时导入
# render_template渲染母版
from flask import Flask,render_template

app=Flask(__name__)
# 装饰器,路由用来封装链接,同时返回数据
@app.route(‘/index‘)
def index_xxx():
# 导入html
# 需要在桌面建立一个templates文件夹,
# 将html放到这个文件夹
return render_template(‘home1.html‘)
# 在函数中只要导入return,return后面的代码就不执行了
return ‘python!!‘
@app.route(‘/login‘)
def login():
# 导入html
# return render_template(‘home.html‘)
# 在函数中只要导入return,return后面的代码就不执行了
return ‘python!!‘

app.debug=True
# 跑服务器
app.run()
# 若果是绝对路径,建立文件夹templates,
# 因为默认的就是这一个文件夹

 3..而且还要利用VS Code编写前台展现的基本页面

<body>
<div>欢迎来到Jaoany的博客!</div>
 
<!--action="/commit"里面是要访问登陆页面的链接-->
<form action="/commit">
<!--<div>html是前端</div>-->
<input type="text"name="username" placeholder="请输入用户名:">
<input type="password" name="psw" placeholder="请输入密码:">
<input type="submit" value="登陆">

</form>
 
</body>
 
4  编写后台和前台的环境
Subline Text 2是编写后台的,VS Code是编写前台的
技术分享

 

python编写简单的html登陆页面(1)

标签:name   type   user   cti   页面   dex   username   line   pytho   

原文地址:http://www.cnblogs.com/fanglijiao/p/6973366.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!