-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
71 lines (53 loc) · 1.75 KB
/
server.py
File metadata and controls
71 lines (53 loc) · 1.75 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
62
63
64
65
66
67
68
69
70
71
from flask import Flask, render_template, request, redirect, url_for
from db_utils import *
app = Flask(__name__, static_url_path='', static_folder='static', template_folder='templates')
@app.route('/')
def home():
return render_template("index.html")
@app.route('/index')
def home2():
return redirect(url_for("home"))
@app.route('/about')
def about():
return render_template("about.html")
@app.route('/blog')
def blog():
return render_template("blog.html")
# @app.route('/gallery')
# def gallery():
# halls = get_all_halls()
# return render_template("blog.html", halls)
@app.route('/gallery')
def gallery_filtered():
data = request.args
if not data:
halls = get_all_halls()
return render_template("gallery.html", list_halls = halls)
halls = get_halls_by_filter(data)
return render_template("gallery.html", list_halls = halls)
@app.route('/gallery-single-post/<hall_id>')
def hall_single_post(hall_id):
hall = get_hall_by_id(hall_id)
# hall = get_hall_by_id("5ffec6cfa2673a61f7064e81")
return render_template("gallery-single-post.html", hall_obj = hall)
@app.route('/hall-single-post2')
def hall_single_post2():
return render_template("gallery-single-post.html")
@app.route('/contact')
def contact():
return render_template("contact.html")
@app.route('/add_place')
def add_place():
return render_template("add_place.html")
@app.route('/add_place', methods = ['POST'])
def submitt_new_place():
data = dict(request.form)
save_hall(data)
return render_template("index.html")
@app.route('/sending_contact', methods = ['POST'])
def sending_contact():
data = dict(request.form)
save_contact(data)
return render_template("index.html")
if __name__ == '__main__':
app.run(port=3000)