期末作品检查
1.期末作品检查:基本要求
检查时间:18最后四节课,上课之前必须全部完成,上课做基本部署就开始检查
方式:逐个运行演示,抽查代码
主题:选一个主题,整个网站风格统一,布局合理,尽量美观。
2.期末作品检查:必须完成:
网站父模板统一布局:头部导航条、底部图片导航、中间主显示区域布局
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>{% block title %} 模板 {% endblock %}</title> {% block head %} <link rel="stylesheet" type="text/css" href="../static/css/text.css"> {% endblock %} <script> function mySwitch() { var myele=document.getElementById("on_off") if(myele.src.match("on")){ myele.src="{{ url_for('static',filename='image/off.jpg') }}" document.getElementById("myBody").style.background="grey" document.getElementById("demo").style.color="antiquewhite" } else { myele.src="{{ url_for('static',filename='image/on.jpg') }}" document.getElementById("myBody").style.background="antiquewhite" document.getElementById("demo").style.color="black" } } </script> </head> <body id="myBody"style="background-color:antiquewhite;"> <nav class="aaa"> <form action="{{ url_for('search') }}" method="get"> <img src="{{ url_for('static',filename='image/5.jpg') }}"style="height: 40px;width: 45px; "> <a href="http://www.iqiyi.com/">爱奇艺官网</a> <a href="http://www.aiqiyibofangqi.com/">APP下载</a> <a href="{{ url_for("wenda") }}">用户问答</a> <a href="{{ url_for("shouye") }}">首页</a> <input name="q" type="text" placeholder="请输入搜索内容"> <input type="submit" value="搜索"> </form> <form class="search"> {% if username %} <a href="{{ url_for('all',user_id=session.get('userid'),tag='1') }}">{{ username }}</a> <a href="{{ url_for('logout') }} ">注销</a> {% else %} <a href="{{ url_for("denglu") }}">用户登录</a> <a href="{{ url_for("zhuce") }}">注册</a> {% endif %} <img class="light" id="on_off" onclick="mySwitch()" src="{{ url_for('static',filename='image/on.') }}" style="height: 40px;width: 35px; " > </form> </nav> <hr> {% block jiemian %} {% endblock %} </body> </html>
注册、登录、注销
{% extends'base.html' %} {% block title %} 用户注册 {% endblock %} {% block jiemian %} <script src="{{ url_for('static',filename='js/cc.js') }}"></script> <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/zhuce.css') }}"> <p>{{ username }}</p> <div class="container" > <form action="{{ url_for('zhuce') }}" method="post"> <div class="header"><h2 align="center" >新用户注册</h2></div> <div class="content" > <div class="input-box"> <br>用户昵称<input id="un" type="text" name="username" placeholder="请输入昵称"> </div> <div class="input-box"> <br>输入密码<input id="pw" type="password" name="password"placeholder="请输入密码"><br> </div> <div class="input-box"> <br>确认密码<input id="tpw" type="password" name="pass"placeholder="请确认密码"><br> </div> <div class="input-box"> <br><button onclick="myLogin()">注册</button> <div class="error_box"><br></div> </div> </div> <div class="footer" >版权*GZCC</div> </form> </div> {% endblock %}
function myLogin() { var one = document.getElementById("un"); var two = document.getElementById("pw"); var three = document.getElementById("error_box"); var four = document.getElementById("tpw"); if (two.value.length < 6) { three.innerHTML = "为了账号安全,请输入6个以上的密码!"; return false } else if ((one.value.charCodeAt(0) >= 48) && one.value.charCodeAt(0) <= 57) { three.innerHTML = "账号首个不能为数字!"; return false } else if (two.value != four.value) { three.innerHTML = "输入密码不一致!请重新输入!"; return false } else for (var i = 1; i < one.value.length; i++) { if ((one.value.charCodeAt(i) < 48 || one.value.charCodeAt(i) > 57) && (one.value.charCodeAt(i) < 97 || one.value.charCodeAt(i) > 122)) { three.innerHTML = "账号只能为数字!"; return false } } if(one.value.length<6){ three.innerHTML="账号需为6-12个长度!"; return false; } return true; }
发布、列表显示
详情页
评论、列表显示
{% extends'base.html' %} {% block title %} 问答平台 {% endblock %} {% block jiemian %} <div id="container" style="width:500px;margin: 0 auto " > <form action="{{ url_for('wenda') }}" method="post"> <div id="header" style="background-color:lightblue;height: 40px"><h2 align="center" style="margin-bottom:0;font-size: 33px;font-family: 楷体" >问答平台</h2></div> <div id="content" style="background-color:#EEEEEE;height: 280px;width:500px;float:left;text-align:center;font-size: 22px"> <label for="aa">标题</label><br> <textarea style="width: 400px" id="aa" name="title"></textarea><br> <label for="bb">详情</label><br> <textarea style="width: 400px" id="bb"rows="9" name="detail"></textarea><br> <input type="submit" value="提交"style="width:65px;height:25px;font-size:15px"> </div> <div id="footer" style="background-color:lightblue;clear:both;text-align:center;height: 40px;font-size: 31px;font-family: 楷体">版权*GZCC</div> </form> </div> {% endblock %}
{% extends'base.html' %} {% block title %} 问答详情页 {% endblock %} {% block js %}{% endblock %} {% block jiemian %} <body bgcolor="antiquewhite"><link rel="stylesheet" type="text/css" href="../static/css/cc.css"> <div class="d1"> <form action="{{ url_for('comment') }}" method="post"> <p><span class="timu">{{ ques.title }}<br></span> <p class="neir" >{{ ques.detail }}</p> <a href="{{ url_for('all',user_id=ques.author_id,tag='1') }}" class="a"><img class="people" src="{{ url_for('static',filename='image/people.png') }}"><span class="xm">{{ ques.author.username }}</span></a> <hr class="hr"> <textarea class="pinglun" name='pinglun'></textarea> <input name="question_id" type="hidden" value="{{ ques.id }}"> <br> <input type="submit" value="发布"style="width:65px;height:25px;font-size:15px"> <p>评论:({{ ques.comments|length }})</p> <table border=1 > {% for foo in ques.comments %} <tr><td> <img class="people" src="{{ url_for('static',filename='image/people.png') }}"> <a href="{{ url_for('all',user_id=foo.author_id,tag=1) }}" class="name">{{ foo.author.username }}</a> <span class="time" >{{ foo.creat_time }}</span><br> <p class="nr">{{ foo.detail }}</p></td></tr> {% endfor %} </table> </form> </div> </body> {% endblock %}
个人中心
搜索,条件组合搜索
{% extends 'base.html' %} {% block title %}个人详情{% endblock %} {% block head %} <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/dd.css') }}"> {% endblock %} {% block jiemian %} <div class="d1"> <ul class="nav_url"> <img src="{{ url_for('static',filename='image/wenhao.png') }}"><h4 role="presentation"><a href="{{ url_for('all',user_id=id,tag='1') }}" >全部问答</a></h4> <img src="{{ url_for('static',filename='image/wujiao.png') }}"><h4 role="presentation"><a href="{{ url_for('all',user_id=id,tag='2') }}">全部评论</a></h4> <img src="{{ url_for('static',filename='image/taiyang.png') }}"><h4 role="presentation"><a href="{{ url_for('all',user_id=id,tag='3') }}" >个人中心</a></h4> </ul> {% block user1 %}{% endblock %} </div> {% endblock %}
{% extends "userbase.html" %} {% block user1 %} {% for foo in questions%} <table border="1" > <tr><td> <img class="people" src="{{ url_for('static',filename='image/people.png') }}"><a href="{{ url_for('all',user_id=foo.author_id,tag='1') }}" class="name">{{ foo.author.username }}</a><br> <p>标题:{{ foo.title }}</p> <p>{{ foo.detail }}</p></td></tr> </table> {% endfor %}<hr> {% endblock %}
<form action="{{ url_for('search') }}" method="get"> <img src="{{ url_for('static',filename='image/5.jpg') }}"style="height: 40px;width: 45px; "> <a href="http://www.iqiyi.com/">爱奇艺官网</a> <a href="http://www.aiqiyibofangqi.com/">APP下载</a> <a href="{{ url_for("wenda") }}">用户问答</a> <a href="{{ url_for("shouye") }}">首页</a> <input name="q" type="text" placeholder="请输入搜索内容"> <input type="submit" value="搜索"> </form>
一篇完整的博客
个人学期总结
总结Python+Flask+MysqL的web建设技术过程,标准如下:
即是对自己所学知识的梳理
也可作为初学入门者的简单教程
也可作为自己以后复习的向导
也是一种向外展示能力的途径
个人学期总结
时间很快,马上大三的第一学期即将过去,回顾自己的信息管理系统这门课,在这一学期确实收获了很多,从最基本的对一个信息系统的了解,到深入理解如何将系统数据存入保存到数据库MySQL中,下面对这学期的课程做一个简单的梳理:
(1)开学第一课,老师带领我们了解了什么是管理信息系统,于是对其有了一个大致的了解,接下来就是学习python语言中的一些基本库,让我们燃起对python语言学习的欲望,印象深刻是那次用turtle库画了五星红旗为祖国庆生。学习的还有一些条件查询循环语句等……
(2)下面主要就是用pycharm软件写网页系统,用html元素制作web页面,做出页面的导航条部分,由于这些东西跟我们日常的网站极为相似,所以大家都燃起了学好页面设计的欲望,登录注册,javascrip基础,登录前端验证,后端将用户数据存到后端的数据库之中,这教给了我们强大的网页设计功能
(3)夜间模式的切换,关闭与开启,父模板的制作,子模板继承父模板与扩展,{block...}{endblock}
(4)用户的发布问答功能,将显示在首页,并记录好发布时间展示给浏览者,浏览对象通过用户名进入查看文章详情,并能发布评论,虽然这些功能可能平时看起来简单简易,但是通过自己的代码实现出来是一种成就,也是一种对知识的掌握。
(5)点击详情页的用户,可以看到各用户的个人中心,这对我说印象深刻,因为个人中心需要继承父模板,然后个人问答、评论又要继承个人中心,这之间还需利用tag调转页面。逻辑紧密并且相互贯通。
(6)最后几节课,老师教会我们如何对密码进行加密以及对模型的分离。
为数18周的信息管理系统的学习让我感受颇深,老师会经常发布作业给我们完成,这对于我们是一种知识巩固的方法,下面是对学好这门课的看法:
(1)不耻下问,我觉得这很重要,上课老师讲的内容如果有不解的地方,要抓住机会问同学,问老师,趁热打铁是学习知识最好的办法。
(2)利用各网站搜索知识,让自己的知识更强大。学习学的精要靠自己课后对加勤奋练习,如今科技发达,利用好网络知识可以学习到更多东西,比如css制作就能参考网站。
(3)多看网页设计,多浏览相关书本,这不但可以让自己开拓眼界的同时还可以愉悦自己。
学完信息管理对一些架构的加深了解:
Python, 是一种面向对象、解释型计算机程序语言。
Flask是一个使用 python编写的轻量级 Web 应用框架,Flask也被称为 "microframework" ,因为它使用简单的核心,用 extension 增加其他功能。Flask没有默认使用的数据库、窗体验证工具。
MySQL 是一种关联数据库管理系统,关联数据库将数据保存在不同的表中,而不是将所有数据放在一个大仓库内,这样就增加了速度并提高了灵活性。MySQL 所使用的 SQL 语言是用于访问数据库的最常用标准化语言。
python+flask+mysql可以作为我们开发web网页的一种工具,其功能我们已经在课程上见证过,其强大需要我们更多加学习去发现。
3.期末作品检查:加分功能
文章分类、显示
点赞、收藏
修改密码、头像、上传头像
我的
高级搜索