Prerequisites
Before starting development, ensure you have the following installed:Python 3.10.11
Required Python version for this project
MySQL Database
Relational database for data persistence
pip
Python package manager
Git
Version control system
Verify Python Installation
Check your Python version:Initial Setup
1. Clone the Repository
2. Create Virtual Environment
Create an isolated Python environment:3. Activate Virtual Environment
- Windows
- Mac/Linux
(venv) at the beginning of your terminal prompt.
4. Install Dependencies
Install all required Python packages:Key Dependencies
Key Dependencies
- Flask 3.1.2 - Web framework
- Flask-SQLAlchemy 3.1.1 - ORM for database operations
- Flask-Migrate 4.1.0 - Database migrations
- Flask-WTF 1.2.2 - Form handling and CSRF protection
- WTForms 3.2.1 - Form validation
- PyMySQL 1.1.2 - MySQL database driver
- Black 26.1.0 - Code formatter
- python-dotenv 1.2.1 - Environment variable management
Environment Configuration
Create Environment File
- Copy the template file:
- Edit
.envwith your configuration:
.env
Database Setup
Create your MySQL database:Run Database Migrations
Apply the database schema:Running the Application
Development Server
Start the Flask development server:- Using Flask CLI
- Using run.py
Verify Installation
Therun.py script includes a database connection test. You should see:
If you see “Database connection successful!” your setup is complete!
Development Tools
Code Formatting with Black
The project uses Black for consistent code formatting:Type Checking with mypy
Run type checking:Troubleshooting
Database Connection Failed
Database Connection Failed
- Verify MySQL is running
- Check credentials in
.envfile - Ensure database exists
- Check firewall settings for port 3306
Module Not Found Errors
Module Not Found Errors
- Ensure virtual environment is activated
- Reinstall dependencies:
pip install -r requirements.txt - Check Python version matches 3.10.11
SECRET_KEY Error in Production
SECRET_KEY Error in Production
The application requires a
SECRET_KEY environment variable in production.
Generate a secure key:Next Steps
Project Structure
Learn about the application architecture
Coding Conventions
Follow the project’s coding standards
Templates Guide
Work with Jinja2 templates
Forms Guide
Create and validate forms