2017年12月8日
摘要: 定义评论的视图函数@app.route('/comment/',methods=['POST'])def comment():读取前端页面数据,保存到数据库中 用<input type="hidden" 方法获取前端的"question_id" 显示评论次数 要求评论前登录 尝试实现详情页面下的评论 阅读全文
posted @ 2017-12-08 10:13 004陈楠芸 阅读(165) 评论(0) 推荐(0) 编辑
  2017年12月5日
摘要: 恢复内容开始 建立评论的对象关系映射: class Comment(db.Model): __tablename__='comment' 尝试实现发布评论。 恢复内容结束 阅读全文
posted @ 2017-12-05 19:24 004陈楠芸 阅读(108) 评论(0) 推荐(0) 编辑
  2017年12月1日
摘要: 首页列表显示全部问答: 完成问答详情页布局: 3. 以往评论列表显示区。 阅读全文
posted @ 2017-12-01 12:35 004陈楠芸 阅读(151) 评论(0) 推荐(0) 编辑
  2017年11月29日
摘要: 1. 在首页添加显示问答的列表,并定义好相应的样式。 无序列表 <ul > <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul> 2. 用字典向index.html传递参数。 阅读全文
posted @ 2017-11-29 18:36 004陈楠芸 阅读(123) 评论(0) 推荐(0) 编辑
  2017年11月28日
摘要: 编写要求登录的装饰器 from functools import wraps def loginFirst(func): #参数是函数 @wraps(func) def wrapper(*args, ** kwargs): #定义个函数将其返回 #要求登录 return func(*args, ** 阅读全文
posted @ 2017-11-28 10:06 004陈楠芸 阅读(190) 评论(0) 推荐(0) 编辑
  2017年11月24日
摘要: 用上下文处理器app_context_processor定义函数 获取session中保存的值 返回字典 在父模板中更新导航,插入登录状态判断代码。、 注意用{% ... %}表示指令。 {{ }}表示变量 完成注销功能。 清除session 跳转 py文件 from flask import Flask, render_template, url_for, redire... 阅读全文
posted @ 2017-11-24 10:02 004陈楠芸 阅读(197) 评论(0) 推荐(0) 编辑
  2017年11月21日
摘要: 登录功能完成: session: 阅读全文
posted @ 2017-11-21 11:21 004陈楠芸 阅读(157) 评论(0) 推荐(0) 编辑
  2017年11月17日
摘要: def regist(): if request.method == 'GET': return render_template('regist.html') else: username = request.form.get(‘username’)#获取form中的数据 判断用户名是否存在 存到数 阅读全文
posted @ 2017-11-17 10:03 004陈楠芸 阅读(148) 评论(0) 推荐(0) 编辑
  2017年11月15日
摘要: 增加:db.session.add(user)db.session.commit() 查询:User.query.filter(User.username == 'mis1114').first() 修改:user.password = '111111'db.session.commit() 删除: 阅读全文
posted @ 2017-11-15 15:57 004陈楠芸 阅读(127) 评论(0) 推荐(0) 编辑
  2017年11月14日
摘要: 安装与配置python3.6+flask+mysql数据库 下载安装MySQL数据库 下载安装MySQL-python 中间件 pip install flask-sqlalchemy (Python的ORM框架SQLAlchemy) mysql创建数据库 数据库配置信息config.py 建立my 阅读全文
posted @ 2017-11-14 10:07 004陈楠芸 阅读(186) 评论(0) 推荐(0) 编辑