源码下载地址:https://download.csdn.net/download/mosquito_lover1/90292074
系统截图:
功能介绍:
响应式设计,完全支持移动端
现代化的UI界面
用户认证系统
课程展示功能
模块化的结构
要进一步完善这个应用,您可以:
添加用户认证系统(登录/注册)
实现课程详情页面
添加支付系统
实现视频播放功能
添加用户评论系统
实现课程进度追踪
核心源码:
from flask import Blueprint, render_template, request, redirect, url_for, flash, session, jsonify
from flask_login import login_required, current_user
from app import db
from app.models import Course, Section, Chapter, UserProgress
from functools import wraps
from app.utils.image_generator import ImageGenerator
from flask import current_app
import os
from werkzeug.utils import secure_filename
from app.utils.content_generator import ContentGenerator
from datetime import datetime
main = Blueprint('main', __name__)
image_generator = ImageGenerator()
content_generator = ContentGenerator()
def admin_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if not current_user.is_authenticated or not current_user.is_admin:
flash('需要管理员权限')
return redirect(url_for('main.index'))
return f(*args, **kwargs)
return decorated_function
@main.route('/')
def index():
courses = Course.query.all()
return render_template('index.html', courses=courses)
@main.route('/admin')
@login_required
@admin_required
def admin():
courses = Course.query.all()
return render_template('admin/dashboard.html', courses=courses)
def allowed_file(filename):
return '.' in filename and filename.rsplit('.', 1)[1].lower() in {'png', 'jpg', 'jpeg', 'gif'}
@main.route('/admin/course/new', methods=['GET', '