摘要: 1.主PY文件写视图函数,带id参数。 @app.route('/detail/<question_id>')def detail(question_id): quest = return render_template('detail.html', ques = quest) 2.首页标题的标签做 阅读全文
posted @ 2017-12-05 21:05 004熊锋阳 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 1.首页列表显示全部问答: a.将数据库查询结果传递到前端页面 Question.query.all() b.前端页面循环显示整个列表。 c.问答排序 2.完成问答详情页布局: a.包含问答的全部信息 b.评论区 c.以往评论列表显示区。 {% extends 'base.html' %}{% bl 阅读全文
posted @ 2017-12-01 12:44 004熊锋阳 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 1. 在首页添加显示问答的列表,并定义好相应的样式。 无序列表 <ul > <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul> 2. 用字典向index.html传递参数。 {% block main%} <p>{{user}} context</p> 阅读全文
posted @ 2017-11-30 16:33 004熊锋阳 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 编写要求登录的装饰器 from functools import wraps def loginFirst(func): #参数是函数 @wraps(func) def wrapper(*args, ** kwargs): #定义个函数将其返回 #要求登录 return func(*args, ** 阅读全文
posted @ 2017-11-29 19:32 004熊锋阳 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 1.用上下文处理器app_context_processor定义函数 2.在父模板中更新导航,插入登录状态判断代码。、 3.完成注销功能。 阅读全文
posted @ 2017-11-24 16:04 004熊锋阳 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 登录功能完成: session: 阅读全文
posted @ 2017-11-22 20:57 004熊锋阳 阅读(180) 评论(0) 推荐(0) 编辑
摘要: def regist(): if request.method == 'GET': return render_template('regist.html') else: username = request.form.get(‘username’)#获取form中的数据 判断用户名是否存在 存到数 阅读全文
posted @ 2017-11-18 10:13 004熊锋阳 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 增加:db.session.add(user)db.session.commit() 查询:User.query.filter(User.username == 'mis1114').first() 修改:user.password = '111111'db.session.commit() 删除:db.session.delete(user)db.session.commit() from f... 阅读全文
posted @ 2017-11-16 16:28 004熊锋阳 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 安装与配置python3.6+flask+mysql数据库 下载安装MySQL数据库 下载安装MySQL-python 中间件 pip install flask-sqlalchemy (Python的ORM框架SQLAlchemy) mysql创建数据库 数据库配置信息config.py 建立my 阅读全文
posted @ 2017-11-14 21:14 004熊锋阳 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 1.带label的文本输入区域 a.<label for=""></label> <textarea " id=""></textarea> 2.为什么要进行管理信息系统的战略规划? 答:(1)合理分配和利用信息资源(信息、信息技术和信息生产者),以节省信息系统的投资; (2)通过制订规划,找出存在 阅读全文
posted @ 2017-11-09 18:01 004熊锋阳 阅读(173) 评论(0) 推荐(0) 编辑