|
|
@ -16,7 +16,8 @@ client = contentful.Client(SPACE_ID, ACCESS_TOKEN) |
|
|
|
|
|
|
|
@app.route('/') |
|
|
|
def index(): |
|
|
|
return render_template('index.html', title='') |
|
|
|
sup_img = get_support_images() |
|
|
|
return render_template('index.html', title='', sup_img_list=sup_img) |
|
|
|
|
|
|
|
@app.route('/events') |
|
|
|
def events(): |
|
|
@ -107,6 +108,26 @@ def process_content(entries, type): |
|
|
|
|
|
|
|
return content_list |
|
|
|
|
|
|
|
def get_support_images(): |
|
|
|
# Specify the folder where images are stored |
|
|
|
image_folder = os.path.join(app.static_folder, 'images/support') |
|
|
|
|
|
|
|
# Define a list of supported image file extensions |
|
|
|
valid_extensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp'] |
|
|
|
|
|
|
|
# List to hold the image file names |
|
|
|
image_files = [] |
|
|
|
|
|
|
|
# Loop through files in the directory |
|
|
|
for filename in os.listdir(image_folder): |
|
|
|
# Check if the file is an image (by extension) |
|
|
|
if os.path.splitext(filename)[1].lower() in valid_extensions: |
|
|
|
image_files.append(filename) |
|
|
|
print(filename) |
|
|
|
|
|
|
|
return image_files |
|
|
|
|
|
|
|
|
|
|
|
def format_datetime(dt): |
|
|
|
date_str = dt.strftime('%d.%m.%y') |
|
|
|
time_str = dt.strftime('%I%p').upper().lstrip('0') |
|
|
|