forked from emyuan124/cshs-website
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
136 lines (106 loc) · 4.02 KB
/
main.py
File metadata and controls
136 lines (106 loc) · 4.02 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
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
from bottle import error, redirect, route, run, static_file
from src.beardify import beardfy_page
from src.projects import *
from src.utils import *
articles = load_projects()
# Includes other HTML elements inside themselves.
# For example, <!--footer--> in pages will be replaced with the footer source code.
elements = {
"head": load_file("elements/head.html"),
"titlebar": load_file("elements/titlebar.html"),
"footer": load_file("elements/footer.html"),
}
# Add list of articles, for article page
elements["articles"] = create_article_list(articles, elements)
format_pages(articles, elements)
# Add redirects to website
# Ex: https://frhs.tech/test -> https://goole.com
route("/github", "GET", lambda: redirect("https://github.com/astatin3/cshs-website"))
##
## CSHS
##
route(
"/cshs_bylaws",
"GET",
lambda: redirect(
"https://docs.google.com/document/d/1YzR-cGSoa1PBMYJVzNoFG7Nfd5CKWblfK_DRL2tByJ0/edit?usp=sharing"
),
)
# Old, 24-25 route("/masterlog", 'GET', lambda: redirect("https://docs.google.com/spreadsheets/d/1ZhljBt7N1RV-9AyAzdGpuxLDA0Tn9Z7dXlnuojYQzPg/edit?usp=sharing"))
route(
"/masterlog",
"GET",
lambda: redirect(
"https://docs.google.com/spreadsheets/d/1yVoUb9HwKQ1EzLD8ybuyULA4SckTp8TJ79K-25Yd1Zs/edit?usp=sharing"
),
)
route(
"/cshs_master_log",
"GET",
lambda: redirect(
"https://docs.google.com/spreadsheets/d/1yVoUb9HwKQ1EzLD8ybuyULA4SckTp8TJ79K-25Yd1Zs/edit?usp=sharing"
),
)
# https://docs.google.com/forms/d/e/1FAIpQLSeVCnBeLAZINfsuv_O8p_GJ2DRyue_IZFRPbi2frTV--aFJJw/viewform
route(
"/cshs_registration", "GET", lambda: redirect("https://forms.gle/Gu74zjMJTttQNsLt7")
)
route("/cshs_signup", "GET", lambda: redirect("https://forms.gle/Gu74zjMJTttQNsLt7"))
# Old, 24-25 route("/hourlog", 'GET', lambda: redirect("https://docs.google.com/spreadsheets/d/1RSi9-gsC4HGqME4LLPqivaVEnLsBzDhyhOcCbQalSDs/edit?usp=sharing"))
route(
"/hourlog",
"GET",
lambda: redirect(
"https://docs.google.com/spreadsheets/d/1FrSHD6S7db_juGQYg3Tou56-KxkRmjMhlmmZfj_8YuQ/edit?usp=sharing"
),
)
route(
"/cshs_hour_log",
"GET",
lambda: redirect(
"https://docs.google.com/spreadsheets/d/1FrSHD6S7db_juGQYg3Tou56-KxkRmjMhlmmZfj_8YuQ/edit?usp=sharing"
),
)
# Same as mster log
# Old, 24-25 route("/cshs_hour_opps", 'GET', lambda: redirect("https://docs.google.com/spreadsheets/d/1ZhljBt7N1RV-9AyAzdGpuxLDA0Tn9Z7dXlnuojYQzPg/edit?usp=sharing"))
route(
"/cshs_hour_opps",
"GET",
lambda: redirect(
"https://docs.google.com/spreadsheets/d/1yVoUb9HwKQ1EzLD8ybuyULA4SckTp8TJ79K-25Yd1Zs/edit?usp=sharing"
),
)
route(
"/instagram", "GET", lambda: redirect("https://www.instagram.com/fossilridge.cshs/")
)
# Route each page to its actual file
route("/", "GET", page("pages/index", elements))
route("/hackathon", "GET", page("pages/hackathon", elements))
route("/foodtrucks", "GET", page("pages/foodtrucks", elements))
route("/board", "GET", page("pages/board", elements))
route("/codingclub", "GET", page("pages/codingclub", elements))
route("/cshs", "GET", page("pages/cshs", elements))
route("/cshs/slides", "GET", page("pages/cshs_slides", elements))
route("/beardify", "GET", beardfy_page(elements))
route("/articles", "GET", page("pages/articles", elements))
route("/writing_an_article", "GET", md_page("pages/writing_an_article", elements))
# Route the /img path to the image directory
@route("/img/<filename:path>")
def img(filename):
return static_file(filename, root=root_img)
# Route the /js path to the javascript directory
@route("/js/<filename:path>")
def js(filename):
return static_file(filename, root=root_js)
# Route the /css path to the css directory
@route("/css/<filename:path>")
def css(filename):
return static_file(filename, root=root_css)
error(403, page_error("pages/403", elements))
error(404, page_error("pages/404", elements))
# @error(404)
# def error404(error):
# return page("404", elements)()
# Run the thing.
if __name__ == "__main__":
run(host="localhost", port=8080, debug=True)