Build a solid foundation for your AI cooking assistant with a modular Flask app. Learn the app factory pattern, Blueprints, and SQLAlchemy models for recipes, ingredients, and reviews. Set up SQLite, add CLI tools for DB management, and create a clean, scalable, production-ready backend.
Overview
Syllabus
- Unit 1: Initializing a Flask App and Setting Up the Database
- Creating Your First Flask App Factory
- Configuring Flask for Database Operations
- Connecting Flask to SQLAlchemy Database
- Creating Database Tables with App Context
- Registering Blueprints for Route Organization
- Starting the Flask Development Server
- Unit 2: Designing Models and Relationships for a Cooking App API
- Creating the SQLAlchemy Database Handler
- Creating Your First Database Model
- Creating the Recipe Model
- Creating Many-to-Many Recipe Relationships
- Creating the Review Model Relationship
- Unit 3: Creating a Safe Database Reset Script for Your Cooking App
- Setting Up Database Reset Imports
- Adding Safety Confirmation to Reset Script
- Fixing Database Deletion Order
- Committing Changes to Complete Database Reset
- Making Your Reset Script Executable
- Unit 4: Creating a Command-Line Script to Add Recipes Manually
- Fixing Python Import Paths
- Adding Recipe Name Input Validation
- Collecting Ingredients with Interactive Input
- Collecting Recipe Steps with Sentinel Values
- Saving Recipes to Database