Skip to content

rdubar/rd-flask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rd-flask

A basic Flask starter project with SQLite, Bootstrap 5, and a blueprints-based route structure. Good starting point for a simple web app.

Features

  • Flask app with a blueprints route structure
  • SQLite database with raw sqlite3 (no ORM)
  • Bootstrap 5 via Bootstrap-Flask
  • Full CRUD example on a posts table
  • Password generator and random-case utilities on the home page
  • Docker support

Project structure

venv/
├── app.py              # App factory
├── init_db.py          # Creates the database with sample data
├── schema.sql          # Database schema
├── requirements.txt
├── routes/
│   ├── index.py        # Home page, utilities
│   └── posts.py        # Posts CRUD routes
├── templates/
│   ├── base.html
│   ├── index.html
│   └── posts/
└── tools/
    ├── rog_tools.py    # General utilities
    └── more_media.py   # Media helpers

Local setup

# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate       # Windows: .venv\Scripts\activate

# Install dependencies
pip install -r venv/requirements.txt

# Initialise the database (creates database.db with sample posts)
cd venv
python init_db.py

# Set required environment variables
export SECRET_KEY="your-secret-key-here"
export FLASK_APP=app.py

# Run the dev server
flask run

Then open http://localhost:5000.

Docker

docker build -t rd-flask .
docker run -e SECRET_KEY="your-secret-key" -p 5000:5000 rd-flask

Based on

How To Use an SQLite Database in a Flask Application — DigitalOcean

About

Flask starter with SQLite, Bootstrap 5, blueprints, CRUD, and Docker

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors