This repository has been archived by the owner on Apr 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wsgi.py
143 lines (106 loc) · 4.72 KB
/
wsgi.py
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
from flask import render_template
from sqlalchemy import func
from Coralite import *
@app.route('/')
@flask_optimize.optimize()
def main():
page_description = Descriptions.query.filter_by(portfolio="default").first()
testimonials = Testimonials.query.order_by(func.rand()).limit(3).all()
return render_template('index.html', page_description=page_description, testimonials=testimonials)
def show(n, Class, portfolio, portfolio_full):
page_description = Descriptions.query.filter_by(portfolio=portfolio).first()
if page_description is None:
page_description = Descriptions.query.filter_by(portfolio="default").first()
row = Class.query.count()
if int(n) is 0:
description = []
location = []
for num in range(1, row + 1):
data = Class.query.filter_by(id=num).first()
description.append(Class.get_description(data))
location.append(Class.get_location(data))
return render_template('Gallery Directory.html', portfolio=portfolio, portfolioFull=portfolio_full, row=row,
description=description, location=location, page_description=page_description, )
elif int(n) >= 1:
data = Class.query.filter_by(id=n).first()
return render_template('Gallery Basic.html', portfolio=portfolio, portfolioFull=portfolio_full,
id=int(n), page_description=page_description, row=row, data=data)
@app.errorhandler(404)
@flask_optimize.optimize()
def page_not_found(e):
page_description = Descriptions.query.filter_by(portfolio="default").first()
return render_template('404.html', page_description=page_description), 404
@app.route('/testimonials')
@flask_optimize.optimize()
def testimonials():
page_description = Descriptions.query.filter_by(portfolio="default").first()
testimonials = Testimonials.query.all()
return render_template('testimonials.html', page_description=page_description, testimonials=testimonials)
@app.route('/additions', methods=['GET'], defaults={'n': 0})
@app.route('/additions/<n>', methods=['GET'])
@flask_optimize.optimize()
def additions(n):
return show(int(n), Additions, 'additions', 'Additions & Renovations')
@app.route('/bars', methods=['GET'], defaults={'n': 0})
@app.route('/bars/<n>', methods=['GET'])
@flask_optimize.optimize()
def bars(n):
return show(int(n), Bars, 'bars', 'Bars & Wine Storage')
@app.route('/basements', methods=['GET'], defaults={'n': 0})
@app.route('/basements/<n>', methods=['GET'])
@flask_optimize.optimize()
def basements(n):
return show(int(n), Basements, 'basements', 'Basements')
@app.route('/bathrooms', methods=['GET'], defaults={'n': 0})
@app.route('/bathrooms/<n>', methods=['GET'])
@flask_optimize.optimize()
def bathrooms(n):
return show(int(n), Bathrooms, 'bathrooms', 'Bathrooms & Vanities')
@app.route('/builtins', methods=['GET'], defaults={'n': 0})
@app.route('/builtins/<n>', methods=['GET'])
@flask_optimize.optimize()
def builtins(n):
return show(int(n), Builtins, 'builtins', 'Built-ins & Bookcases')
@app.route('/decks', methods=['GET'], defaults={'n': 0})
@app.route('/decks/<n>', methods=['GET'])
@flask_optimize.optimize()
def decks(n):
return show(int(n), Decks, 'decks', 'Decks & Porches')
@app.route('/kitchens', methods=['GET'], defaults={'n': 0})
@app.route('/kitchens/<n>', methods=['GET'])
@flask_optimize.optimize()
def kitchens(n):
return show(int(n), Kitchens, 'kitchens', 'Kitchens')
@app.route('/mantels', methods=['GET'], defaults={'n': 0})
@app.route('/mantels/<n>', methods=['GET'])
@flask_optimize.optimize()
def mantels(n):
return show(int(n), Mantels, 'mantels', 'Mantels')
@app.route('/mudrooms', methods=['GET'], defaults={'n': 0})
@app.route('/mudrooms/<n>', methods=['GET'])
@flask_optimize.optimize()
def mudrooms(n):
return show(int(n), Mudrooms, 'mudrooms', 'Mudrooms & Closets')
@app.route('/offices', methods=['GET'], defaults={'n': 0})
@app.route('/offices/<n>', methods=['GET'])
@flask_optimize.optimize()
def offices(n):
return show(int(n), Offices, 'offices', 'Desks & Offices')
@app.route('/paneling', methods=['GET'], defaults={'n': 0})
@app.route('/paneling/<n>', methods=['GET'])
@flask_optimize.optimize()
def paneling(n):
return show(int(n), Paneling, 'paneling', 'Paneling & Wainscoting')
@app.route('/stock', methods=['GET'], defaults={'n': 0})
@app.route('/stock/<n>', methods=['GET'])
@flask_optimize.optimize()
def stock(n):
return show(int(n), Stock, 'stock', 'Stock Cabinets')
@app.route('/tv', methods=['GET'], defaults={'n': 0})
@app.route('/tv/<n>', methods=['GET'])
@flask_optimize.optimize()
def tv(n):
return show(int(n), TV, 'tv', 'TV Entertainment Centers')
if __name__ == "__main__":
db.create_all()
app.run(host="0.0.0.0")