摘要: 首页列表显示全部问答: 将数据库查询结果传递到前端页面 Question.query.all() 前端页面循环显示整个列表。 问答排序 @app.route('/shouye/') def shouye(): context = { 'questions':Question.query.order_ 阅读全文
posted @ 2017-12-06 15:17 阿植 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 1. 在首页添加显示问答的列表,并定义好相应的样式。 无序列表 <ul > <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul> 2. 用字典向index.html传递参数。 from flask import Flask, render_template 阅读全文
posted @ 2017-12-01 21:23 阿植 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 编写要求登录的装饰器 from functools import wraps def loginFirst(func): #参数是函数 @wraps(func) def wrapper(*args, ** kwargs): #定义个函数将其返回 #要求登录 return func(*args, ** 阅读全文
posted @ 2017-11-28 17:50 阿植 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 用上下文处理器app_context_processor定义函数 获取session中保存的值 返回字典 @app.context_processor def mycontext(): username = session.get('user') if username: return {'username':username} else: ... 阅读全文
posted @ 2017-11-24 21:47 阿植 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 登录功能完成: js:设置return function fnLogin() { var oUname = document.getElementById("uname"); var oError = document.getElementById("error_box"); var oUpass 阅读全文
posted @ 2017-11-22 21:30 阿植 阅读(446) 评论(0) 推荐(0) 编辑
摘要: def regist(): if request.method == 'GET': return render_template('regist.html') else: username = request.form.get(‘username’)#获取form中的数据 判断用户名是否存在:存在报 阅读全文
posted @ 2017-11-22 15:53 阿植 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 增加:user = 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() ... 阅读全文
posted @ 2017-11-17 20:49 阿植 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 安装与配置python3.6+flask+mysql数据库 下载安装MySQL数据库 下载安装MySQL-python 中间件 pip install flask-sqlalchemy (Python的ORM框架SQLAlchemy) mysql创建数据库 数据库配置信息config.py SQLA 阅读全文
posted @ 2017-11-14 11:46 阿植 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 1.带label的文本输入区域 <label for=""></label><textarea " id=""></textarea> 2.为什么要进行管理信息系统的战略规划? (1)合理分配和利用信息资源,以节省信息系统的资源。 (2)通过制定战略规划,找出存在的问题,正确地识别出为实现企业目标M 阅读全文
posted @ 2017-11-12 19:04 阿植 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 首页 登录页 注册页 首页 登录 注册 阅读全文
posted @ 2017-11-08 13:14 阿植 阅读(214) 评论(0) 推荐(0) 编辑