-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
61 lines (50 loc) · 1.53 KB
/
Copy pathapp.py
File metadata and controls
61 lines (50 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import flask
from flask import request
app = flask.Flask(__name__)
generalP = []
gamesP = []
tvP = []
booksP = []
@app.route('/')
def home():
return flask.render_template('index.html')
@app.route('/about')
def about():
return flask.render_template('about.html')
@app.route('/books', methods=['GET', 'POST'])
def books():
if request.method == "GET":
return flask.render_template('books.html', posts = booksP)
else:
post = request.json
booksP.append(post)
return flask.render_template('books.html', posts = booksP)
@app.route('/games', methods=['GET', 'POST'])
def games():
if request.method == "GET":
return flask.render_template('games.html', posts = gamesP)
else:
post = request.json
gamesP.append(post)
return flask.render_template('games.html', posts = gamesP)
@app.route('/general', methods=['GET', 'POST'])
def general():
if request.method == "GET":
return flask.render_template('general.html', posts = generalP)
else:
post = request.json
generalP.append(post)
return flask.render_template('general.html', posts = generalP)
@app.route('/tv', methods=['GET', 'POST'])
def tv():
if request.method == "GET":
return flask.render_template('tv.html', posts = tvP)
else:
post = request.json
tvP.append(post)
return flask.render_template('tv.html', posts = tvP)
@app.route('/post')
def post():
return flask.render_template('post.html')
if __name__ == "__main__":
app.run()