You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
ccicnce113424 4e678a7a0f
feat: leaderboard and data export
1 month ago
app feat: leaderboard and data export 1 month ago
.env.example feat: init flask skeleton with auth and pages 1 month ago
.envrc feat: init flask skeleton with auth and pages 1 month ago
.gitignore feat: init flask skeleton with auth and pages 1 month ago
README.md feat: init flask skeleton with auth and pages 1 month ago
requirements.txt chore: fix environment 1 month ago
run.py feat: init flask skeleton with auth and pages 1 month ago
shell.nix chore: fix environment 1 month ago

README.md

课堂点名系统(最小可运行版本)

安装依赖

cd class-random-caller
python -m venv venv
source venv/bin/activate  # Windows 使用 venv\\Scripts\\activate
pip install -r requirements.txt

配置数据库

在项目根目录创建 .env 文件,内容示例:

SECRET_KEY=your-secret-key
DATABASE_URL=mysql+pymysql://user:password@host:3306/dbname

请将 user/password/host/dbname 替换为你在免费 MySQL 服务上的实际信息。

初始化数据库

在 Python 交互环境或单独脚本中执行:

from run import app
from app import db
from app.models import User
from werkzeug.security import generate_password_hash

with app.app_context():
    db.create_all()
    # 创建一个管理员账号(只需执行一次)
    if not User.query.filter_by(username="admin").first():
        u = User(username="admin", password_hash=generate_password_hash("admin123"))
        db.session.add(u)
        db.session.commit()

运行项目

python run.py

浏览器打开 http://127.0.0.1:5000/auth/login,使用 admin / admin123 登录。