期末做品检查

  1. 网站父模板统一布局:头部导航条、底部图片导航、中间主显示区域布局
  2. 注册、登陆、注销
  3. 发布、列表显示
  4. 详情页
  5. 评论、列表显示
  6. 我的中心
  7. 搜索,条件组合搜索
    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>{% block title%}car{% endblock %}</title>
        <link href="{{ url_for('static',filename='css/base.css') }}" rel="stylesheet" type="text/css">
        <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
       <script src="{{ url_for('static',filename='js/base.js') }}"></script>
    {% block head %}
    
    
    {% endblock %}
        <style>
            nav navbar-nav li {
                list_style: none;
                float: left;
                margin: 10px;
            }
    
            .nav1 li{
                    list-style: none;
                    float: left;
                    margin: 10px;
                }
        </style>
    </head>
    <body id="mybody">
    <div class="daohang_box"><form action="{{ url_for('search')}}" method="get" >
    <nav class="navbar" role="navigation" style="">
        <div class="container-fluid" id="container">
            <div class="navbar-header">
                <a class="navbar-brand" href="{{ url_for('index') }}">首页</a>
            </div>
            <div>
                <ul class="nav navbar-nav">
                    {% if username %}
                        <li><a href={{ url_for('usercenter',user_id=session.get('userid'),tag=1) }}>{{ username }}</a></li>
                        <li><a href="{{ url_for('logout') }}">注销 </a></li>
                    {% else %}
                    <li><a href="{{ url_for('login') }}" onclick="">登陆</a></li>
                    <li><a href="{{ url_for('regist') }}" onclick="">注册</a></li>
                    {% endif %}
                    <li><a href="{{ url_for('lable') }}" onclick="">发布问答</a></li>
                </ul>
            </div>
           <div style="float: right">
               <img style="width: 50px; height: 50px" id="myonoff" onclick="mySwitch()" src="http://up.enterdesk.com/edpic/78/9a/ac/789aacfb997963e7a3516dd916448acc.jpg" style="width:50px" >
           </div>
            <div><input id="search_box" name='q'type="text" placeholder="请输入关键词查找">
            <button id="search" type="submit">搜索</button>
    
            </div>
    {#    <body background="http://p5.so.qhimgs1.com/bdr/_240_/t01fb87f1928a69d5eb.jpg" style="width: 100%; height: 100%"></body>#}
    
        </div>
    </nav>
    </form>
    {% block main %}{% endblock %}
    
    </body >
    </html>
    </body>
    {% extends 'base.html' %}
    {% block title %}detail{% endblock %}
    {% block head %}
        {#    <script src="{{ url_for('static',filename='js/base.js') }}" type="text/javascript"></script>#}
        <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/detail.css') }}">
    {% endblock %}
    {% block main %}
        <div align="center">
            <div class="a1">
                 <h3>{{ ques.title }}<br><small>{{ ques.author.Username }}
                        <span class="badge">{{ ques.creat_time }}</span></small></h3></div>
                        <p class="lead">{{ ques.detail }}</p>
                <h3>
            <form action="{{ url_for('comment') }}" method="post">
    {
                <br></div>
            <div class="a2" style="margin-left: 25%">
                <div class="pinglun"><label for="comment">评论</label><br></div>
                <textarea id="comment" rows="5" name="commentdetail" style="width: 90ch"></textarea></div>
            <input name="question_id" type="hidden" value="{{ ques.id }}"/>
            <button type="submit" class="fasong" style="margin-left: 25%">发送评论</button>
            <h4 style="margin-left: 25%">comment:({{ ques.comments|length }})</h4>
        </div>
            </form>
    
        <ul class="list-group" style="margin-left:20%;margin-top: 5%;margin-right:20%">
            {% for foo in ques.comments %}
                    <li class="list-group-item" >
                    <a href={{ url_for('usercenter',user_id=foo.author_id,tag=1 )}}>{{ foo.author.username }} </a><br>
                        <a href={{ url_for('detail',question_id=foo.id)}}>{{ foo.title }}</a>
    
                        <span class="badge">{{ foo.creat_time }}</span>
                        <p class="abstract">{{ foo.detail }}</p>
                    </li>
            {% endfor %}
        </ul>
        </div>
    {% endblock %}
    {% extends 'base.html' %}
    
    {% block title %}首页{% endblock %}
    
    {% block head %}
        <link href="{{ url_for('static',filename='css/index.css') }}" rel="stylesheet" type="text/css">
        <script src="{{ url_for('static',filename='js/index.js') }}"></script>
    {% endblock %}
    
    {% block main %}
        <ul class="list-group" style="margin-left:20%;margin-top: 5%;margin-right:20%">
    {#    <li class="list-group-item">#}
    {#        <span class="glyphicon glyphicon-leaf" aria-hidden="true"></span>#}
    {#        <a href="{{ url_for('detail')}}">username</a>#}
    {#        <br>#}
    {#        <a href="#)"title></a>#}
    {#        <span class="badge">create_time</span>#}
    {#       <p>detauk</p>#}
            {% for foo in question %}
                    <li class="list-group-item" >
                    <a href={{ url_for('usercenter',user_id=foo.author_id,tag=1 )}}>{{ foo.author.username }} </a><br>
                        <a href={{ url_for('detail',question_id=foo.id)}}>{{ foo.title }}</a>
    
                        <span class="badge">{{ foo.creat_time }}</span>
                        <p class="abstract">{{ foo.detail }}</p>
                    </li>
            {% endfor %}
        </ul>
    <div>
    
    </div>
    
    {% endblock %}
    {% extends 'base.html' %}
    {% block title %}
        发布问答
    {% endblock %}
    {% block head %}
    
    {%  endblock %}
    {% block main %}
    <form  class="all" action="{{ url_for('lable') }}" method="POST">
        <div style="margin-left:30%;margin-top: 10%" >
            <h3 >发布问答</h3>
            <div class="form_group"></div>
            <div class="form_group">
                <!--<label for="questionDetial">标题</label>-->
                <!--<textarea class="form-control" rows="1" id="questionDetial"></textarea>-->
                <label for="biaoti">标题</label>
                <input id="biaoti" type="text" placeholder="请输入标题!" name="title">
    
            </div>
            <div class="form_group" >
                <label for="questionDetial">详情</label>
                <textarea class="form-control" rows="5" id="questionDetial" style="width:60rem " name="detail"></textarea>
            </div>
    </div>
    
            <div class="checkbox" style="margin-left:30%;margin-top: 1%">
                <button type="submit" class="btn bun-default">发布</button>
            </div>
    
    </form>
    {%  endblock %}
    {% extends 'base.html' %}
    
    {% block title %}登陆{% endblock %}
    
    {% block head %}
        <link href="{{ url_for('static',filename='css/login.css') }}" rel="stylesheet" type="text/css">
        <script src="{{ url_for('static',filename='js/login.js') }}"></script>
    {% endblock %}
    {% block main %}
    <div class="a" >
        <div class="login" ><h2>登陆</h2></div>
        <form action="{{ url_for('login') }}"method="post">
        <div class="a1" >
            用户名:<input id="name" type="text"placeholder="请输入用户名" name="username"><br>
            密  码: <input id="password" type="password"placeholder="请输入密码" name="password"><br>
            </div>
            <div id="error_box"><br></div>
          <div class="a2" >
             <button onclick="myLogin()">登陆</button>
             <button type="button" onclick=window.alert("是否取消登陆!")>取消</button>
    </div>
        </div>
    
        </form>
    {% endblock %}
    {% extends 'base.html' %}
    
    {% block title %}注册{% endblock %}
    
    {% block head %}
        <link href="{{ url_for('static',filename='css/regist.css') }}" rel="stylesheet" type="text/css">
        <script src="{{ url_for('static',filename='js/regist.js') }}"></script>
    {% endblock %}
    
    {% block main %}
    <div class="a" >
        <div class="regist" ><h2>注册</h2></div>
        <form action="{{ url_for('regist') }}"method="post" onsubmit="return myLogin()">
        <div class="a1" >
            用户名:<input id="name" type="text"placeholder="请输入用户名" name="username"><br>
            昵  称: <input id="nickname" type="text"placeholder="请输入昵称" name="nickname"><br>
            密  码: <input id="password" type="password"placeholder="请输入密码" name="password"><br>
            密  码: <input id="password1" type="password"placeholder="请再次输入密码" name="password1"><br>
    
        </div>
            <div id="error_box"><br></div>
          <div class="a2" >
             <button >注册</button>
             <button type="button" onclick=window.alert("是否取消登陆!")>取消</button>
    </div>
    
        </div>
    
        </div>
        </form>
    {% endblock %}
    {% extends 'userbase.html' %}
    
    {% block user %}
        {% block head %}
            <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/userbase.css') }}">
            <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/user.css') }}">
        {% endblock %}
        <div class="a1">
            <h3>{{ username }}</h3><br>
    {#            <small>所有问答</small>#}
            </div>
            <ul>
                {% for foo in user.question %}
                    <li class="list-group-item" >
                    <a href={{ url_for('index')}}>{{ foo.author.username }} </a><br>
                        <a href={{ url_for('detail',question_id=foo.id)}}>{{ foo.title }}</a>
    
                        <span class="badge">{{ foo.creat_time }}</span>
                        <p class="abstract">{{ foo.detail }}</p>
                    </li>
            {% endfor %}
            </ul>
        </div>
    
    {% endblock %}
    
    
    {% extends 'userbase.html' %}
    
    {% block user %}
        {% block head %}
            <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/userbase.css') }}">
            <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/user.css') }}">
        {% endblock %}
    
        <div class="a1">
            <h3>{{ username}}
    {#            <small>我的信息</small>#}
            </h3><br>
            <ul>
                <li href={{ url_for('index' )}}>用户:{{ username}}</li>
                <li>编号:{{ user.id}}</li>
                <li>昵称:{{ user.nickname}}</li>
                <li>文章篇数:{{ user.question|length }}</li>
                <li>评论数:{{ user.comment|length }}</li>
            </ul>
    </div>
    
    {% endblock %}
    
    
    {% extends 'base.html' %}
    {% block title %}我的中心{% endblock %}
    
    {% block head %}
            <style>
                .nav1 >li{
                    list-style: none;
                    float: left;
                    margin: 10px;
                }
            </style>
    
    {% endblock %}
    
    {% block main %}
         <div class="nav1">
            <ul>
                <li role="presentation"><a href="{{ url_for('usercenter',user_id=user.id ,tag='1')}}">所有问答</a></li>
                <li role="presentation"><a href="{{ url_for('usercenter',user_id=user.id ,tag='2')}}">所有评论</a></li>
                <li role="presentation"><a href="{{ url_for('usercenter',user_id=user.id ,tag='3')}}">我的资料</a></li>
            </ul>
        </div>
        {% block user %}{% endblock %}
    {% endblock %}
    
    {% extends 'base.html' %}
    {% block title %}我的中心{% endblock %}
    {% block head %}
        <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/usercenter.css') }}">
    {% endblock %}
    {% block main %}
        <div class="a1">
            <h3>{{ username }}<br>
                <small>所有问答</small>
            </h3></div>
            <ul>
                {% for foo in ques.question %}
                    <li class="list-group-item" >
                    <a href="#">{{ foo.author.username }} </a><br>
                        <a href={{ url_for('detail',question_id=foo.id)}}>{{ foo.title }}</a>
    
                        <span class="badge">{{ foo.creat_time }}</span>
                        <p class="abstract">{{ foo.detail }}</p>
                    </li>
            {% endfor %}
    
        <div class="a1">
            <h3>{{ username }}<br>
                <small>所有评论</small>
            </h3></div>
            <ul>
                {% for foo in ques.comments %}
                    <li class="list-group-item" >
                    <a href="#">{{ foo.author.username }} </a><br>
                        <a href={{ url_for('detail',question_id=foo.id)}}>{{ foo.title }}</a>
    
                        <span class="badge">{{ foo.creat_time }}</span>
                        <p class="abstract">{{ foo.detail }}</p>
                    </li>
            {% endfor %}
    
        <div class="a1">
           <h3>{{ username}}
    {#            <small>我的信息</small>#}
            </h3><br>
            <ul>
                <li>用户:{{ username}}</li>
                <li>编号:{{ user.id}}</li>
                <li>昵称:{{ user.nickname}}</li>
                <li>文章篇数:{{ user.questions|length }}</li>
    
            </ul>
    
    
    
    {% endblock %}

     

    1. 我的学期总结
    2. 总结Python+Flask+MysqL的web建设技术过程,标准以下:
      1. 便是对本身所学知识的梳理
      2. 也可做为初学入门者的简单教程
      3. 也可做为本身之后复习的向导
      4. 也是一种向外展现能力的途径                                                                                                                                                                                                                                                                
        这学期学习了WEB的建设,运用了Python+Flask+MysqL,Python是一种面向对象的解释型 计算机程序设计语言,由荷兰人 Guido van Rossum于1989年发明,第一个公开发行版发行于1991年。Python是纯粹的 自由软件,  源代码解释器CPython遵循  GPL( GNU General Public License)协议 。Python语法简洁清晰,特点之一是强制用空白符(white space)做为语句缩进。Python具备丰富和强大的库。它常被昵称为 胶水语言,可以把用其余语言制做的各类模块很轻松地联结在一块儿。常见的一种应用情形是,使用Python快速生成程序的原型(有时甚至是程序的最终界面),而后对其中[有特别要求的部分,用更合适的语言改写,好比 3D游戏中的图形渲染模块,性能要求特别高,就能够用C/C++重写,然后封装为Python能够调用的扩展类库。须要注意的是在您使用扩展类库时可能须要考虑平台问题,某些可能不提供 跨平台的实现。
        Flask是一个使用  Python 编写的轻量级 Web 应用框架。其  WSGI 工具箱采用 Werkzeug , 模板引擎则使用 Jinja2 。Flask使用 BSD 受权。
        Flask也被称为 “microframework” ,由于它使用简单的核心,用 extension 增长其余功能。Flask没有默认使用的数据库、窗体验证工具。
        MySQL是一种关系数据库管理系统,关系数据库将数据保存在不一样的表中,而不是将全部数据放在一个大仓库内,这样就增长了速度并提升了灵活性。
        MySQL所使用的 SQL 语言是用于访问 数据库的最经常使用标准化语言。MySQL 软件采用了双受权政策,分为社区版和商业版,因为其体积小、速度快、整体拥有成本低,尤为是 开放源码这一特色,通常中小型网站的开发都选择 MySQL 做为网站数据库。
相关文章
相关标签/搜索
本站公众号
   欢迎关注本站公众号,获取更多信息