Skip to content

Commit 02cbd75

Browse files
committed
Merge pull request Show-Me-the-Code#171 from lwhhhh/master
留言板
2 parents f59a287 + a3d1020 commit 02cbd75

File tree

9 files changed

+88
-0
lines changed

9 files changed

+88
-0
lines changed

lwh/23MessageBoard/app/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from flask import Flask
2+
3+
app = Flask(__name__)
4+
5+
from app import views

lwh/23MessageBoard/app/models.py

Whitespace-only changes.
1.12 KB
Binary file not shown.
8.73 KB
Loading
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head lang="en">
4+
<meta charset="UTF-8">
5+
<title></title>
6+
<!-- 新 Bootstrap 核心 CSS 文件 -->
7+
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
8+
</head>
9+
<style type="text/css">
10+
11+
</style>
12+
<body>
13+
<nav class="navbar navbar-default">
14+
<div class="container-fluid">
15+
<!-- Brand and toggle get grouped for better mobile display -->
16+
<div class="navbar-header">
17+
<a class="navbar-brand" href="#">
18+
<img alt="Brand" src="/static/brand.ico">
19+
</a>
20+
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
21+
<span class="sr-only"></span>
22+
<span class="icon-bar"></span>
23+
<span class="icon-bar"></span>
24+
<span class="icon-bar"></span>
25+
</button>
26+
<a class="navbar-brand" href="#">LWH的留言板</a>
27+
</div>
28+
29+
<!-- Collect the nav links, forms, and other content for toggling -->
30+
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
31+
32+
<form class="navbar-form navbar-left" role="search">
33+
<div class="form-group">
34+
<input type="text" class="form-control" >
35+
</div>
36+
<button type="submit" class="btn btn-default">搜索</button>
37+
</form>
38+
39+
</div><!-- /.navbar-collapse -->
40+
</div><!-- /.container-fluid -->
41+
</nav>
42+
43+
{% block content %}
44+
{% endblock %}
45+
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
46+
<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
47+
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
48+
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
49+
</body>
50+
</html>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{% extends 'base.html' %}
2+
{% block content %}
3+
<h2>留言失败,未定义相关处理函数</h2>
4+
{% endblock %}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{% extends 'base.html' %}
2+
{% block title %}
3+
<title>给lwh的留言板</title>
4+
{% endblock %}
5+
{% block content %}
6+
<form action="/postmessage" method="post">
7+
名字:
8+
<input type="text" name="name"/>
9+
<br><br>
10+
内容:
11+
<input type="text" name="content"/>
12+
<br><br>
13+
<button type="submit" name="submit"/>留言
14+
</form>
15+
{% endblock %}

lwh/23MessageBoard/app/views.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from app import app
2+
from flask import render_template
3+
4+
@app.route('/')
5+
def index():
6+
return render_template('index.html')
7+
8+
@app.route('/postmessage',methods=["POST",])
9+
def postMessage():
10+
return render_template('handlemessage.html')

lwh/23MessageBoard/run.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from app import app
2+
3+
if __name__ == '__main__':
4+
app.run(debug=True,port=5000)

0 commit comments

Comments
 (0)