40 lines
971 B
Python
40 lines
971 B
Python
"""Main routes - Dashboard, Home"""
|
|
|
|
from flask import Blueprint, render_template, redirect, url_for, session
|
|
from database.models import VirtualHost
|
|
from routes.auth_routes import login_required
|
|
import logging
|
|
|
|
main_bp = Blueprint('main', __name__)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
@main_bp.route('/')
|
|
def index():
|
|
"""Dashboard - list vhosts"""
|
|
if 'user_id' not in session:
|
|
return redirect(url_for('auth.login'))
|
|
|
|
return render_template('dashboard.html')
|
|
|
|
|
|
@main_bp.route('/home')
|
|
@login_required
|
|
def home():
|
|
"""Home - alias for dashboard"""
|
|
return redirect(url_for('main.index'))
|
|
|
|
|
|
@main_bp.route('/display_logs')
|
|
@login_required
|
|
def display_logs():
|
|
"""Display HAProxy logs"""
|
|
return render_template('logs.html')
|
|
|
|
|
|
@main_bp.route('/display_haproxy_stats')
|
|
@login_required
|
|
def display_haproxy_stats():
|
|
"""Display HAProxy statistics"""
|
|
return render_template('statistics.html')
|