Educational content management system with subscription-based access.
- Role-based access control (Admin/Moderator/Instructor/Student)
- Group-based content isolation
- File upload and distribution
- Subscription management with YooKassa payments
- Ticket support system
- Telegram bot integration
- Backend: Python 3.11, Flask 3.0, SQLAlchemy 2.0
- Database: SQLite (development), PostgreSQL (production)
- Frontend: Jinja2, Bootstrap 5, JavaScript
- Deployment: Docker, Gunicorn, Nginx
- Python 3.11+
- Docker & Docker Compose (recommended)
- Git
git clone https://github.com/cy7su/cysu.git
cd cysu
# Setup virtual environment
python -m venv venv
source venv/bin/activate # Linux/Mac
# venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your settings
# Initialize database
flask db upgrade
# Create admin user
python scripts/create_admin.py
# Start application
python run.pyVisit http://localhost:8001
# Build and run
docker build -f deployment/Dockerfile -t cysu .
docker run -d -p 8001:8001 --env-file .env cysu
# Or use docker-compose
docker-compose up -dKey environment variables (see .env.example):
SECRET_KEY=your-secret-key-here
DATABASE_URL=sqlite:///app.db
MAIL_SERVER=smtp.gmail.com
MAIL_USERNAME=user@gmail.com
MAIL_PASSWORD=your-app-password
YOOKASSA_SHOP_ID=your-shop-id
YOOKASSA_SECRET_KEY=your-secret-key
UPLOAD_FOLDER=app/static/uploadscysu/
├── app/ # Main application
│ ├── __init__.py # Flask app factory
│ ├── models.py # SQLAlchemy models
│ ├── forms.py # WTForms
│ ├── views/ # Route handlers
│ ├── services/ # Business logic
│ ├── templates/ # Jinja2 templates
│ └── utils/ # Helper functions
├── deployment/ # Docker configs
├── docs/ # Documentation
├── scripts/ # Utility scripts
└── run.py # Application entry point
POST /login- User loginPOST /register- User registrationGET /logout- User logout
GET /- Homepage with subjectsGET /subject/<id>- Subject detailsGET /material/<id>- Material detailsPOST /material/<id>/submit_solution- Submit assignment
GET /files/<subject_id>/<filename>- Download filesPOST /material/<id>/add_solution- Upload solution files
POST /subject/<id>/edit- Edit subjectPOST /material/<id>/edit- Edit materialPOST /toggle-admin-mode- Switch admin interface
GET /api/notifications- User notificationsPOST /api/subject/<id>/pattern- Update subject patterns
- CSRF protection on forms
- Secure session management
- File upload validation
- SQL injection prevention via SQLAlchemy
- XSS protection in templates
- Role-based access control
# Run tests
pytest
# Code formatting
ruff format .
# Type checking
mypy app/# Create migration
flask db migrate -m "Add new table"
# Apply migrations
flask db upgrade
# Rollback
flask db downgradeMIT License