""" Quick test to verify Flask routes are registered correctly Run this from the app folder: python test_routes.py """ import sys import os # Add current directory to path sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) try: from app import app print("=" * 60) print("FLASK ROUTES TEST") print("=" * 60) print() print("āœ“ Flask app imported successfully") print() print("Registered routes:") print("-" * 60) routes = [] for rule in app.url_map.iter_rules(): routes.append({ 'endpoint': rule.endpoint, 'methods': ', '.join(sorted(rule.methods - {'HEAD', 'OPTIONS'})), 'path': str(rule) }) # Sort by path routes.sort(key=lambda x: x['path']) # Find all login-related routes login_routes = [r for r in routes if 'login' in r['path'].lower() or 'login' in r['endpoint'].lower()] user_routes = [r for r in routes if 'user' in r['path'].lower()] print("\nšŸ“ Login & Authentication Routes:") for route in login_routes: print(f" {route['path']:40} [{route['methods']:15}] -> {route['endpoint']}") print("\nšŸ‘„ User Management Routes:") for route in user_routes: print(f" {route['path']:40} [{route['methods']:15}] -> {route['endpoint']}") print("\nšŸ“Š Total routes registered:", len(routes)) print() print("=" * 60) print("āœ“ All routes loaded successfully!") print("=" * 60) print() print("To start the server:") print(" python app.py") print() print("Then access:") print(" http://localhost:8080/login") print(" http://localhost:8080/users") print() except ImportError as e: print("=" * 60) print("āŒ IMPORT ERROR") print("=" * 60) print() print(f"Failed to import Flask app: {e}") print() print("This might be because:") print(" 1. Flask is not installed: pip install Flask") print(" 2. Werkzeug is not installed: pip install Werkzeug") print(" 3. There's a syntax error in app.py") print() print("Try running:") print(" pip install -r requirements.txt") print() except Exception as e: print("=" * 60) print("āŒ ERROR") print("=" * 60) print() print(f"Error: {e}") print() import traceback traceback.print_exc() print()