Skip to main content

A set of command line tools that help you scaffold out your flask application quickly.

Project description

Flask-Commands logo Flask-Commands

pypi tests coverage docs license stars

Flask-Commands is a local-first CLI that scaffolds Flask projects and automates the wiring between views, routes, controllers, and models so you ship faster with consistent structure.

Getting Started

Flask-Commands bundles opinionated, productivity-focused generators:

  • flask new boots a ready-to-run Flask project with virtualenv, dotenv, Tailwind wiring, and SQLite + migrations by default. Use --no-db to skip DB setup.
  • flask make:view generates template files and can optionally wire controllers, routes/blueprints, and SQLAlchemy models.
  • flask make:controller scaffolds a controller class and can optionally add RESTful actions, routes, templates, and model generation (--model or -m, with --flat/--nest for inferred model choices).
  • flask make:model scaffolds a SQLAlchemy model and can optionally wire RESTful controllers, routes, and templates (--crud, with --flat/--nest for model structure selection).

All generated code is plain Flask with no hidden runtime layers; every file is created on disk. The goal is to remove repetitive setup work while keeping everything local and transparent.

Installation

Flask-Commands is designed to be installed globally so you can create new Flask apps anywhere on your machine.

Recommended:

pipx install Flask-Commands --include-deps

Alternative:

pip install Flask-Commands

You will also want npm available because generated Flask projects include Tailwind CSS tooling. If npm is not installed, install Node.js first.

Quick Start

flask new myproject          # includes a SQLite DB scaffolding by default
cd myproject

To create a project without database support, use:

flask new myproject --no-db

Recommended (macOS):

./run.sh

Manual startup:

source venv/bin/activate
flask run --debug

run.sh opens a Flask shell, starts the dev server, rebuilds tailwind.css and tailwind.min.css, opens VS Code and Chrome, and hot-reloads changes in templates/, controllers/, forms/, models/, and routes/.

Browser reloading uses fswatch, so install it first if it is not already available:

brew install fswatch

Docs quick links

Cheat sheet

  • flask new myproject — New Flask project with DB scaffolding (default).
  • flask new myproject --no-db — New Flask project without DB setup.
  • flask make:view about — Template only (app/templates/about.html).
  • flask make:view recipes.index -rcm — Start a recipe resource with a list page, route, controller, and model.
  • flask make:view recipes.show -rc — Add a detail page to the existing recipe resource.
  • flask make:view recipes.create -rcm — Add a GET action that renders a recipe form template.
  • flask make:view recipes.store -rcm — Add a POST action that wires behavior without creating a template.
  • flask make:view recipes.comments.index -rcm — Create a nested comments resource under recipes.
  • flask make:controller RecipeController --crud — Generate RESTful controller methods, routes, and templates for recipes.
  • flask make:controller RecipeController --crud -m — Generate the RESTful recipe resource and matching model in one controller-first command.
  • flask make:controller ShoppingListController --crud --model ShoppingList — Keep a multi-word model name together while generating RESTful scaffolding.
  • flask make:controller RecipeIngredientController --crud -m --nest — Force the nested model interpretation for a controller-first --crud flow.
  • flask make:model Recipe — Create and register a single model scaffold.
  • flask make:model Recipe --crud — Model + RESTful controller/routes/templates.
  • flask make:model ShoppingList --crud --flat — Force a flat model interpretation and RESTful structure.
  • flask make:model RecipeIngredient --crud --nest — Force a nested model interpretation and RESTful structure.

Examples

Here are a few commands and what they do so you can see the speed, consistency gains, and how commands combine in practice.

1) Create a recipe index page with full wiring

flask make:view recipes.index -rcm

This scaffolds:

  • the template at app/templates/recipes/index.html
  • a controller with an index method
  • a RESTful route for /recipes
  • a Recipe model plus registration in app/models/__init__.py

2) Add a recipe detail page to the same resource

flask make:view recipes.show -rc

Because Recipe is already registered, route inference generates the RESTful show route:

  • /recipes/<int:recipe_id>
  • the controller method signature includes recipe_id

3) Generate a full RESTful resource from the controller first

flask make:controller RecipeController --crud -m

This scaffolds the seven RESTful actions across:

  • controller methods
  • routes in app/routes/recipes/
  • templates for the GET actions (index, show, create, and edit)
  • a Recipe model plus registration

4) Handle nested recipe/ingredient model shape intentionally

flask make:model RecipeIngredient --crud

If nested candidates are detected, you will get a prompt to choose flat vs nested. To skip the prompt explicitly:

flask make:model RecipeIngredient --crud --flat
flask make:model RecipeIngredient --crud --nest

Contributing

I’m keeping development closed for now, but feedback is welcome. Please open an issue for bugs or ideas. License: MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_commands-0.3.3.tar.gz (55.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_commands-0.3.3-py3-none-any.whl (69.1 kB view details)

Uploaded Python 3

File details

Details for the file flask_commands-0.3.3.tar.gz.

File metadata

  • Download URL: flask_commands-0.3.3.tar.gz
  • Upload date:
  • Size: 55.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flask_commands-0.3.3.tar.gz
Algorithm Hash digest
SHA256 54c7e9e276add81ee7ce2d6220b96dbf489ecbbec722ca7ab5d19efc07ff2042
MD5 b6c3028804e6b116b9c14766bf747f04
BLAKE2b-256 5f1cc79702cfa2682e8f0c45627ae2416bbe3fb5e5b08a7ebf7c7f3d745a5c80

See more details on using hashes here.

Provenance

The following attestation bundles were made for flask_commands-0.3.3.tar.gz:

Publisher: publish-to-pypi-on-version-change.yml on drewbutcher/flask-commands

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flask_commands-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: flask_commands-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 69.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for flask_commands-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8868b17ea0b64868df610d14dd5e1d1e0e139cdee4a2120d78fb4fe386d66321
MD5 4b382f770472de637b81f35dada64296
BLAKE2b-256 fedf17db649667ba7cc4e83df2515b2c08a725f3e211fe99f24ab4d4378be7ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for flask_commands-0.3.3-py3-none-any.whl:

Publisher: publish-to-pypi-on-version-change.yml on drewbutcher/flask-commands

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page