-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
76 lines (63 loc) · 2.22 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
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
from flask import Flask, request, render_template, redirect
from reader import reader
from datetime import datetime
import os, sys
import logging
import random
app = Flask(__name__)
count = 0
posts = reader('posts.txt')
coop = {
'term' : 'January 2025',
'type' : 'Computer Science',
'year' : 'senior'
}
error_text = [
"Need help finding yourself?",
"I hope this wasn't my fault. If it was, please let me know!",
"I hope this wasn't my fault (´・_・`)",
"Oof"
]
footer = {
'insta' : 'instagram.com/wilsonmcdade',
'linkedin' : 'linkedin.com/in/wilsonmcdade',
'email' : '[email protected]'
}
tracker = "<script async src=\"https://www.googletagmanager.com/gtag/js?id=G-B8\
H3YC8FGK\"></script><script>window.dataLayer = window.dataLayer || [];function \
gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-B8H3\
YC8FGK');</script>"
@app.route('/projects/<name>')
def post(name):
for post in posts:
if post['url'] == name:
return render_template('post.html',blogpost = post,posts=posts, coop=coop, footer=footer,tracker=tracker)
@app.route('/')
@app.route('/index')
@app.route('/index.html')
def index():
return render_template('index.html', posts=posts, coop = coop, footer=footer, tracker=tracker)
@app.route('/blog')
@app.route('/projects')
@app.route('/drinkr')
@app.route('/rtlsdr')
@app.route('/gokart')
def projects():
return render_template('blog.html', posts=posts, coop = coop,footer=footer,tracker=tracker)
@app.route('/resume.html')
@app.route('/resume')
def resume():
return redirect('/static/assets/resume.pdf')
@app.route('/portfolio.html')
@app.route('/portfolio')
def portfolio():
return render_template('portfolio.html', coop = coop, footer=footer,tracker=tracker)
@app.errorhandler(404)
def error_404(e):
return render_template('404.html', error_message=error_text[random.randint(0,len(error_text)-1)], coop = coop, footer=footer,tracker=tracker)
if __name__ == "__main__":
if os.path.exists("logs/") == False:
os.mkdir("logs/")
logging.basicConfig(filename='logs/app.log', filemode='a',format='%(asctime)s :: %(levelname)s :: %(message)s')
logging.info('Begin logging')
app.run("0.0.0.0",port="8080")