from flask import Blueprint, render_template, request, redirect, url_for, flash from flask_login import login_required, current_user from app.models import Post, PostImage, GPXFile, User, db from werkzeug.utils import secure_filename from werkzeug.exceptions import RequestEntityTooLarge import os import uuid from datetime import datetime main = Blueprint('main', __name__) @main.route('/') def index(): """Landing page with about, accommodation, and community sections""" return render_template('index.html') @main.route('/favicon.ico') def favicon(): """Serve favicon""" return redirect(url_for('static', filename='favicon.ico')) @main.route('/health') def health_check(): """Health check endpoint""" return {'status': 'healthy', 'timestamp': datetime.utcnow().isoformat()} @main.route('/map-test') def map_test(): """Serve the map test page""" from flask import send_from_directory return send_from_directory('static', 'map_test.html') @main.route('/basic-map-test') def basic_map_test(): """Serve the basic map test page""" from flask import send_from_directory return send_from_directory('static', 'basic_map_test.html') @main.app_errorhandler(404) def not_found_error(error): return render_template('errors/404.html'), 404 @main.app_errorhandler(500) def internal_error(error): db.session.rollback() return render_template('errors/500.html'), 500 @main.app_errorhandler(RequestEntityTooLarge) def file_too_large(error): flash('File is too large. Maximum file size is 16MB.', 'error') return redirect(request.url)