From d9b8edbc7d23c051dac026b0574d2025b1fdb3d0 Mon Sep 17 00:00:00 2001 From: Eric Lay Date: Thu, 28 Mar 2024 11:13:50 -0500 Subject: [PATCH] Update app.py Rework on 404 error handling --- app.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app.py b/app.py index 307cce7..a6b0088 100644 --- a/app.py +++ b/app.py @@ -4,16 +4,12 @@ from flask import Flask, send_from_directory, session, Blueprint, render_templat app = Flask(__name__) app.secret_key = '420-69-LOL' # For using client side session cookies -# Script must run from root dir containing all websites dirs -# OR change the ROOT_DIR path :) -ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) -# Point jinja to templates -site = Blueprint('site', __name__, template_folder='Templates') # Site choosing logic def current_website_dir(): # Script must run from root dir containing all websites dirs # OR change the ROOT_DIR path :) + ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) WEBSITE_DIRS = [name for name in os.listdir(ROOT_DIR) if not name.startswith('.') and os.path.isdir(os.path.join(ROOT_DIR, name))] session.pop('website_dir', None) # Clear website_dir if exist match session['requests']: #Match Nth page request