Upload files to "/"
This commit is contained in:
29
app.py
29
app.py
@ -1,6 +1,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import random
|
||||||
from flask import Flask, render_template, request, redirect, url_for, abort
|
from flask import Flask, render_template, request, redirect, url_for, abort
|
||||||
|
|
||||||
from Modules.windows import get_windows_content
|
from Modules.windows import get_windows_content
|
||||||
@ -70,20 +71,21 @@ def get_readme_description():
|
|||||||
|
|
||||||
return " ".join(description) if description else "No description available."
|
return " ".join(description) if description else "No description available."
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def home():
|
def home():
|
||||||
|
# Define the path to the Cover_Images directory
|
||||||
|
cover_images_path = os.path.join(app.static_folder, 'Pictures', 'Cover_Images')
|
||||||
|
|
||||||
|
# Get the list of image filenames in the directory
|
||||||
|
cover_images = [
|
||||||
|
os.path.join('Pictures', 'Cover_Images', filename)
|
||||||
|
for filename in os.listdir(cover_images_path)
|
||||||
|
if filename.lower().endswith(('png', 'jpg', 'jpeg', 'gif'))
|
||||||
|
]
|
||||||
|
|
||||||
|
# Randomly select one image
|
||||||
|
selected_image = random.choice(cover_images) if cover_images else None
|
||||||
|
|
||||||
# Read description from README.md
|
# Read description from README.md
|
||||||
readme_description = get_readme_description()
|
readme_description = get_readme_description()
|
||||||
|
|
||||||
@ -97,7 +99,8 @@ def home():
|
|||||||
full_ascii_art=full_ascii_art_stripped,
|
full_ascii_art=full_ascii_art_stripped,
|
||||||
infinitei=infinitei_stripped,
|
infinitei=infinitei_stripped,
|
||||||
links=links,
|
links=links,
|
||||||
readme_description=readme_description
|
readme_description=readme_description,
|
||||||
|
selected_image=selected_image
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route('/methodology')
|
@app.route('/methodology')
|
||||||
|
Reference in New Issue
Block a user