feat: Update home page
All checks were successful
Build Docker / Build Image (push) Successful in 40s
All checks were successful
Build Docker / Build Image (push) Successful in 40s
This commit is contained in:
17
server.py
17
server.py
@@ -2,7 +2,7 @@ from flask import Flask, make_response, redirect, request, jsonify, render_templ
|
||||
import os
|
||||
import dotenv
|
||||
import requests
|
||||
import CloudFlare
|
||||
import datetime
|
||||
|
||||
app = Flask(__name__)
|
||||
dotenv.load_dotenv()
|
||||
@@ -40,20 +40,29 @@ def wallet(path):
|
||||
|
||||
|
||||
|
||||
# Special routes
|
||||
@app.route('/email')
|
||||
def email():
|
||||
return redirect('mailto:hns@hns.au')
|
||||
|
||||
|
||||
|
||||
# Main routes
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
year = datetime.datetime.now().year
|
||||
return render_template('index.html',year=year)
|
||||
|
||||
@app.route('/<path:path>')
|
||||
def catch_all(path):
|
||||
year = datetime.datetime.now().year
|
||||
# If file exists, load it
|
||||
if os.path.isfile('templates/' + path):
|
||||
return render_template(path)
|
||||
return render_template(path, year=year)
|
||||
|
||||
# Try with .html
|
||||
if os.path.isfile('templates/' + path + '.html'):
|
||||
return render_template(path + '.html')
|
||||
return render_template(path + '.html', year=year)
|
||||
|
||||
return render_template('404.html'), 404
|
||||
|
||||
|
||||
Reference in New Issue
Block a user