Migrate from Quart to Flask and add MariaDB dynamic database

Major Changes:
- Migrated web framework from Quart (async) to Flask (sync)
- Added MariaDB database integration with SQLAlchemy ORM
- Implemented dynamic content management for portfolio

New Features:
- Database models for Profile, Skills, Projects, ProjectTags, and SocialLinks
- RESTful API endpoints for CRUD operations on all entities
- Database initialization script (init_db.py) with sample data
- Docker Compose configuration with MariaDB service

Modified Files:
- app.py: Replaced Quart with Flask, added database initialization
- config.py: Added database configuration with environment variables
- routes/home.py: Converted async to sync, added database queries
- requirements.txt: Replaced Quart/Hypercorn with Flask/Gunicorn, added Flask-SQLAlchemy and PyMySQL
- docker-compose.yml: Added MariaDB service with health checks
- templates/: Updated all templates to use dynamic data from database with Jinja2
- .env.example: Added database configuration variables
- README.md: Complete rewrite with new setup instructions and API documentation

New Files:
- models.py: SQLAlchemy models for all database entities
- init_db.py: Database initialization script
- routes/api.py: REST API endpoints for content management

Benefits:
- Simplified architecture (sync vs async)
- Better ecosystem compatibility
- Dynamic content management via database
- Easy content updates through REST API
- Improved deployment with standard WSGI server (Gunicorn)
This commit is contained in:
Claude
2025-11-13 09:16:24 +00:00
parent 058f6205d7
commit c6425235a2
13 changed files with 1010 additions and 217 deletions

View File

@@ -1,24 +1,32 @@
aiofiles==24.1.0
annotated-types==0.7.0
blinker==1.9.0
click==8.1.8
# Core Flask Framework
Flask==3.1.0
h11==0.14.0
h2==4.1.0
hpack==4.0.0
Hypercorn==0.17.3
hyperframe==6.0.1
itsdangerous==2.2.0
Jinja2==3.1.5
Werkzeug==3.1.3
click==8.1.8
itsdangerous==2.2.0
MarkupSafe==3.0.2
priority==2.0.0
blinker==1.9.0
# Database - Flask-SQLAlchemy and MariaDB/MySQL driver
Flask-SQLAlchemy==3.1.1
SQLAlchemy==2.0.36
PyMySQL==1.1.1
cryptography==44.0.0
# Configuration Management
pydantic==2.10.4
pydantic-settings==2.7.1
pydantic_core==2.27.2
python-dotenv==1.0.1
Quart==0.20.0
annotated-types==0.7.0
typing_extensions==4.12.2
Werkzeug==3.1.3
wsproto==1.2.0
# Testing
httpx==0.27.0
pytest==8.3.4
# Documentation
Sphinx==8.2.3
# WSGI Server (Production alternative to Flask dev server)
gunicorn==23.0.0