diff --git a/app.py b/app.py index 6a0174d..e657247 100644 --- a/app.py +++ b/app.py @@ -13,12 +13,18 @@ unique_requests = set() # OR change the ROOT_DIR path below :) 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))] +print(ROOT_DIR) # Site choosing logic website_dir = None def current_website_dir(): - global website_dir - website_dir = random.choice(WEBSITE_DIRS) + global request_count + request_count += 1 + if request_count % 5 == 0: + global website_dir + website_dir = str(ROOT_DIR+"/Marvel") + else: + website_dir = random.choice(WEBSITE_DIRS) # Make static files available @app.route('/', methods=['GET']) @@ -29,13 +35,7 @@ def static_proxy(filename): @app.route('/', methods=['GET']) def index(): current_website_dir() - global request_count - request_count += 1 - - if request_count % 5 == 0: - return send_from_directory(str(ROOT_DIR+"Marvel/"), 'index.html') - else: - return send_from_directory(website_dir, 'index.html') + return send_from_directory(website_dir, 'index.html') if __name__ == "__main__": app.run()