Flite Documentation
A Python CLI tool for generating Flask applications with modern best practices.
Installation
Flite is a Python CLI tool for generating Flask projects. Since it's currently in development, you'll need to install it from source.
# Clone the repository
git clone https://github.com/Artbyo3/flite.git
cd flite
# Install in development mode
pip install -e .
Note
Make sure you have Python 3.8+ installed and pip available.
Verify Installation
Check if Flite is installed correctly:
flite --version
Quick Start
Create your first Flask project in under 2 minutes.
Initialize Project
Create a new Flask project with Flite's default template.
flite create
Navigate to Project
Move into your project directory and explore the structure.
cd my-project
Run Development Server
Start the development server and see your app in action.
flite run
Success!
Your Flask application is now running at http://localhost:5000. Open your browser and start building!
Project Structure
Understanding the default project structure created by Flite.
my-project/
โโโ app/
โ โโโ __init__.py
โ โโโ models/
โ โโโ views/
โ โโโ templates/
โ โโโ static/
โโโ tests/
โโโ requirements.txt
โโโ config.py
โโโ run.py
โโโ README.md
app/
Main application package containing all your Flask code
models/
Database models and data structures
views/
Route handlers and business logic
templates/
Jinja2 HTML templates
static/
CSS, JavaScript, and image assets
tests/
Unit and integration tests
Commands
Complete reference of all available Flite CLI commands.
flite init
CoreInitialize a new Flask project with the specified template.
flite init <project-name> [options]
Options:
--templateSpecify template to use--databaseDatabase type (sqlite, postgresql, mysql)--authInclude authentication system
flite run
DevelopmentStart the Flask development server with hot reload.
flite run [options]
Options:
--hostHost to bind to (default: 127.0.0.1)--portPort to bind to (default: 5000)--debugEnable debug mode
flite generate
UtilityGenerate additional components for your existing project.
flite generate [component] [--name NAME]
Components:
modelCreate a new database modelviewGenerate a new view/routetemplateCreate a new HTML template
flite build
ProductionBuild the application for production deployment.
flite build [options]
Options:
--optimizeOptimize assets and code--minifyMinify CSS and JavaScript--outputOutput directory
Templates
Choose from our pre-built templates to get started quickly with different types of Flask applications.
Web Application
Complete web application with frontend templates, static files, and responsive design.
API Only
RESTful API with authentication, serialization, and comprehensive error handling.
Full Stack
Complete full-stack application with frontend, backend, and database integration.
Configuration
Customize your Flask application with flexible configuration options.
Configuration File
Flite generates a comprehensive configuration file for your project:
import os
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'dev-secret-key'
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'sqlite:///app.db'
SQLALCHEMY_TRACK_MODIFICATIONS = False
class DevelopmentConfig(Config):
DEBUG = True
class ProductionConfig(Config):
DEBUG = False
Troubleshooting
Common issues and their solutions to help you get unstuck.
ImportError: No module named 'flite'
Solution: Make sure Flite is installed in your current Python environment. Try running pip install flite or check your virtual environment activation.
Port 5000 already in use
Solution: Use a different port with flite serve --port 5001 or stop the process using port 5000.
Database connection errors
Solution: Check your database configuration in config.py and ensure your database server is running.