摘要: 首页列表显示全部问答: 完成问答详情页布局: 在首页点击问答标题,链接到相应详情页。 阅读全文
posted @ 2017-12-05 20:25 JaTae 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 1. 在首页添加显示问答的列表,并定义好相应的样式。 无序列表 <ul > <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul> 2. 用字典向index.html传递参数。 阅读全文
posted @ 2017-12-01 11:41 JaTae 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 编写要求登录的装饰器 from functools import wraps def loginFirst(func): #参数是函数 @wraps(func) def wrapper(*args, ** kwargs): #定义个函数将其返回 #要求登录 return func(*args, ** 阅读全文
posted @ 2017-11-28 15:44 JaTae 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 用上下文处理器app_context_processor定义函数 获取session中保存的值 返回字典 在父模板中更新导航,插入登录状态判断代码。 注意用{% ... %}表示指令。 {{ }}表示变量 完成注销功能。 清除session 跳转 {% block title %} {% endblock %} ... 阅读全文
posted @ 2017-11-24 11:42 JaTae 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 登录功能完成: session: 阅读全文
posted @ 2017-11-22 16:00 JaTae 阅读(182) 评论(0) 推荐(0) 编辑
摘要: def regist(): if request.method == 'GET': return render_template('regist.html') else: username = request.form.get(‘username’)#获取form中的数据 判断用户名是否存在:存在报 阅读全文
posted @ 2017-11-21 20:46 JaTae 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 增加:user = db.session.add(user)db.session.commit() #增加 user = User(username ='JACKSON',password='0328' ) db.session.add(user) db.session.commit() 查询:User.query.filter(User.username == 'mis1114').fir... 阅读全文
posted @ 2017-11-17 17:38 JaTae 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 安装与配置python3.6+flask+mysql数据库 下载安装MySQL数据库 下载安装MySQL-python 中间件 pip install flask-sqlalchemy (Python的ORM框架SQLAlchemy) mysql创建数据库 数据库配置信息config.py 建立mysql和app的连接 创建用户模型 from flask import Flask, ren... 阅读全文
posted @ 2017-11-14 20:30 JaTae 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 1、带label的文本输入区域 <label for=""></label><textarea " id=""></textarea> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 % ex 阅读全文
posted @ 2017-11-10 14:57 JaTae 阅读(428) 评论(0) 推荐(0) 编辑
摘要: 首页 登录 注册 阅读全文
posted @ 2017-11-07 21:35 JaTae 阅读(168) 评论(0) 推荐(0) 编辑