Update app.py
- moving escape template choosing logic into the website_dir function to better grab assets - changed formatting on string for selecting escape template
This commit is contained in:
parent
ee1403de23
commit
574c66db5e
12
app.py
12
app.py
|
@ -13,11 +13,17 @@ 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 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
|
||||
|
@ -29,12 +35,6 @@ 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')
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in New Issue