Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lwh/23MessageBoard/app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from flask import Flask

app = Flask(__name__)

from app import views
Empty file.
Binary file added lwh/23MessageBoard/app/static/brand.ico
Binary file not shown.
Binary file added lwh/23MessageBoard/app/static/brand.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions lwh/23MessageBoard/app/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<style type="text/css">

</style>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img alt="Brand" src="/static/brand.ico">
</a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">LWH的留言板</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">

<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" >
</div>
<button type="submit" class="btn btn-default">搜索</button>
</form>

</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>

{% block content %}
{% endblock %}
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>
</html>
4 changes: 4 additions & 0 deletions lwh/23MessageBoard/app/templates/handlemessage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% extends 'base.html' %}
{% block content %}
<h2>留言失败,未定义相关处理函数</h2>
{% endblock %}
15 changes: 15 additions & 0 deletions lwh/23MessageBoard/app/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends 'base.html' %}
{% block title %}
<title>给lwh的留言板</title>
{% endblock %}
{% block content %}
<form action="/postmessage" method="post">
名字:
<input type="text" name="name"/>
<br><br>
内容:
<input type="text" name="content"/>
<br><br>
<button type="submit" name="submit"/>留言
</form>
{% endblock %}
10 changes: 10 additions & 0 deletions lwh/23MessageBoard/app/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from app import app
from flask import render_template

@app.route('/')
def index():
return render_template('index.html')

@app.route('/postmessage',methods=["POST",])
def postMessage():
return render_template('handlemessage.html')
4 changes: 4 additions & 0 deletions lwh/23MessageBoard/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from app import app

if __name__ == '__main__':
app.run(debug=True,port=5000)