Lesson 1: Project Setup for Pizza Management System
Set up a new Flask project using GitHub template, configure Heroku deployment with JawsDB MySQL, and establish local development environment for building a multi-table pizza management application.
Lesson Objectives
- Create GitHub repository from template for M5 demo project
- Configure Heroku application with automatic GitHub deployment
- Set up JawsDB MySQL database provisioning in Heroku
- Establish local development environment with virtual environment
- Configure environment variables for database connectivity using AI assistance
Watch: Project Setup for Pizza Management System
Project Setup for Pizza Management System - Notes
GitHub Repository Setup
Start a new Flask project for the Pizza Management System using an established template. This project will demonstrate a complete multi-table system with customers, pizzas, orders, and authentication.
Repository creation steps:
# Navigate to CRUD template repository
# 1. Click 'Use this template' button
# 2. Select 'Create a new repository'
# 3. Repository name: M5-demo01
# 4. Set visibility to Private
# 5. Click 'Create repository'The Pizza Management System will include:
- User authentication with logout functionality
- Dashboard with customers, pizza options, total orders, and sales
- Customer management with modal-based add/edit/delete
- Pizza management for different sizes and prices
- Order system with order details and sales tax calculation
- Two navigation bars (authenticated and public)
- Logout protection preventing back navigation
Heroku Application Configuration
Set up the Heroku application to host your Pizza Management System with database capabilities.
Heroku setup process:
# Navigate to Heroku Dashboard
# 1. Click 'New' -> 'Create new app'
# 2. App name: M5-demo01
# 3. Choose region (US or Europe)
# 4. Click 'Create app'Connect GitHub repository for automatic deployment:
# In Heroku app dashboard:
# 1. Go to 'Deploy' tab
# 2. Select 'GitHub' as deployment method
# 3. Search for repository: M5-demo
# 4. Click 'Connect' when repository appears
# 5. Scroll to 'Automatic deploys'
# 6. Click 'Enable Automatic Deploys'
# 7. Click 'Deploy Branch' for initial deploymentThis configuration ensures that changes pushed to GitHub automatically deploy to Heroku.
JawsDB MySQL Provisioning
Add JawsDB MySQL database to your Heroku application for storing customers, pizzas, orders, and user data.
Database provisioning steps:
# In Heroku app dashboard:
# 1. Navigate to 'Resources' tab
# 2. In 'Add-ons' search box, type: JawsDB MySQL
# 3. Select 'JawsDB MySQL' from dropdown
# 4. Choose plan: Kitefin Shared (Free)
# 5. Click 'Submit Order Form'
# 6. Wait for provisioning to completeRetrieve database credentials:
# After provisioning completes:
# 1. Click on 'JawsDB MySQL' in Resources tab
# 2. Copy the connection string
# 3. Save credentials for later use in .env file
# Note: These databases will be deleted after project completionJawsDB provides a MySQL database that supports multiple related tables needed for the Pizza Management System.
Local Development Environment Setup
Clone the repository and establish local development environment for Flask application development.
Repository cloning:
# Copy repository URL from GitHub
# Open terminal in desired directory
# Clone repository to local machine
git clone https://github.com/yourusername/M5-demo01.git
# Navigate to project directory
cd M5-demo01
# Open in Cursor or preferred IDE
code .Workspace optimization tips:
# Maximize screen real estate:
# - Drag sidebar as far left as possible
# - Collapse unnecessary panels
# - Use split terminal view for multiple tasksThe cloned repository contains the complete Flask template structure for building the multi-table pizza management application.
Virtual Environment Creation and Dependency Installation
Create an isolated Python environment for project dependencies to avoid conflicts with system packages.
Virtual environment setup:
# Open terminal in project root
# Create virtual environment
python -m venv venv
# When prompted in IDE, click 'Yes' to use as workspace interpreter
# Activate virtual environment
venv\Scripts\activate
# Verify activation (terminal should show (venv) prefix)
# Example: (venv) C:\Users\Name\M5-demo01>Install project dependencies:
# Install requirements from template
pip install -r requirements.txt
# Note: Be careful with tab completion
# Type 'req' then tab (not 'read' which autocompletes to README.md)
# Common packages typically included:
# Flask==2.3.3
# python-dotenv==1.0.0
# mysql-connector-python==8.1.0
# Flask-Login (for authentication)
# werkzeug (for password hashing)The virtual environment isolates your project dependencies and ensures consistent development across different machines.
Environment Configuration with AI Assistance
Configure environment variables for secure database connectivity using AI tools to parse JawsDB credentials efficiently.
Rename and create .env file:
# In project explorer:
# 1. Right-click on .env.example file
# 2. Select 'Rename'
# 3. Change to: .env
# 4. File will be ignored by Git (.gitignore)Start Claude AI assistant:
# Open new terminal (keep venv terminal separate)
# Start Claude Code assistant
claude
# Wait for Claude to initialize
# Press 1 to proceed when promptedUse AI to update .env file efficiently:
# In Claude terminal, type:
"Change out the .env credentials for the database with this information"
# Right-click and paste entire JawsDB connection string
# Example format:
# mysql://username:password@host:port/database
# Claude will parse and update .env file with:
# DB_HOST=host
# DB_USER=username
# DB_PASSWORD=password
# DB_NAME=database
# DB_PORT=portThis AI-assisted method is faster and more accurate than manual parsing of database credentials.
Heroku Config Vars Configuration
Add database credentials to Heroku config vars to enable production database connectivity.
Efficient method for adding config vars:
# In Heroku dashboard:
# 1. Navigate to 'Settings' tab
# 2. Click 'Reveal Config Vars'
# 3. JawsDB automatically adds JAWSDB_URL
# Add individual credentials for clarity:
# Copy entire line from .env file (including value)
# Example: DB_HOST=abc123.jawsdb.com
# In Heroku Config Vars:
# 1. Paste entire line in KEY field
# 2. Cut the value part (after =)
# 3. Delete = sign from KEY field
# 4. Paste value in VALUE field
# 5. Click 'Add'
# Repeat for each variable:
# - DB_HOST
# - DB_USER
# - DB_PASSWORD
# - DB_NAME
# - DB_PORTThis copy-paste-cut method is more efficient than typing each credential separately and reduces errors.
Important notes:
- Remove the equal sign (=) from KEY field
- Ensure no extra spaces in values
- Verify all five database variables are added
Project Setup Verification
Verify that all setup steps are complete and the project is ready for database development.
Setup checklist:
- GitHub repository created and cloned locally
- Heroku application created with automatic deployment enabled
- JawsDB MySQL provisioned in Heroku Resources
- Virtual environment created and activated
- Dependencies installed from requirements.txt
- .env file created with database credentials
- Heroku config vars configured with database credentials
- Claude AI assistant ready for development support
The project foundation is now complete and ready for database schema design and table creation in the next lesson.