-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
46 lines (34 loc) · 1.15 KB
/
app.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
from flask import Flask, render_template, make_response, abort
import os, random
from datetime import date
listofffiles = [i[:-5] if i.endswith(".html") else i for i in os.listdir("templates")]
def create_app():
app = Flask(__name__)
@app.errorhandler(403)
def forbidden403(e):
return make_response(render_template("error_pages/403.html"), 403)
@app.errorhandler(404)
def notfound404(e):
return make_response(render_template("error_pages/404.html"), 404)
@app.route("/whatever")
def ellmao():
abort(403)
@app.route("/")
def index():
return render_template("pages/index.html", age = get_age())
@app.route("/blog")
def blog():
return render_template("pages/blog.html")
@app.route("/contact")
def contact():
return render_template("pages/contact.html")
@app.route("/portfolio")
def other():
return render_template("pages/portfolio.html")
return app
# create_app().run(debug=True)
def get_age():
today = date.today()
born = date(2004, 2, 23)
age = today.year - born.year - ((today.month, today.day) < (born.month, born.day))
return age