toaster
This commit is contained in:
11
src/main.py
11
src/main.py
@@ -1,4 +1,4 @@
|
||||
from flask import Flask, request, render_template, send_from_directory
|
||||
from flask import Flask, request, render_template, send_from_directory, abort
|
||||
from flask_session import Session
|
||||
from dotenv import load_dotenv
|
||||
from os import getenv as env
|
||||
@@ -29,7 +29,6 @@ db = database.Database(db_name=env('DB_NAME', default='db.sqlite'))
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
logging.info("Rendering index page")
|
||||
return render_template('index.html')
|
||||
|
||||
|
||||
@@ -43,6 +42,14 @@ def web_stuffs():
|
||||
)
|
||||
|
||||
|
||||
@app.route('/<path:path>')
|
||||
def catch_all(path):
|
||||
try:
|
||||
return render_template(path + '.html')
|
||||
except Exception as e:
|
||||
abort(404)
|
||||
|
||||
|
||||
@app.route('/404')
|
||||
@app.errorhandler(404)
|
||||
def not_found():
|
||||
|
Reference in New Issue
Block a user