前言
web开发:
-前端:HTML,CSS,JavaScript
-web框架:接收请求并处理
-MYSQL数据库:存储数据的地方
快速上手:
基于Flask Web框架搭建一个网站
深入学习:
基于Django框架
利用flask快速搭建网站
from flask import Flask
app = Flask(__name__)
@app.route("/")
def index():
return "hello word"
if __name__ == '__main__':
app.run()
引入flask框架中render_template
render_template()函数是flask函数,它从模板文件夹templates中返回文件内容。
使用render_template函数来实现渲染模板
from flask import Flask,render_template
app = Flask(__name__)
@app.route("/")
def index():
return render_template("index.html")
if __name__ == '__main__':
app.run()
浏览器标签
<meta charset="UTF8"> #文件编码
div和span
<div>内容</div>
<span>内容+</span>
- div块级标签。一人占一行
- span行内标签,内联标签。自己多大占多少
表格
<table>
<thead>
<tr> <th>ID</th> <th>姓名</th> <th>年龄</th> </tr>
</thead>
<tbody>
<tr> <th>1</th> <th>效力</th> <th>19</th> </tr>
<tr> <th>2</th> <th>小猫</th> <th>20</th> </tr>
<tr> <th>3</th> <th>小狗</th> <th>21</th> </tr>
<tr> <th>4</th> <th>小黄</th> <th>22</th> </tr>
</tbody>
</table>
下拉框
<select name="" id="">
<option value="">北京</option>
<option value="">上海</option>
<option value="">深圳</option>
</select>
多行文本
<textarea></textarea>
小结
- 学习的标签
<h1></h1>
<div></div>
<span></span>
<a></a>
<img/>
- 划分
-块级标签
<h1></h1>
<div></div>
-行内标签
<span></sapn>
<a></a>
<img/>
- 嵌套
<div>
<span>
<a>
<img/>
</a>
</span>
<span>
<ul>
<li>
无序列表
</li>
</ul>
<ol>
<li>
有序列表
</li>
</ol>
</span>
</div>