A set of command line tools that help you scaffold out your flask application quickly.
Project description
Flask-Commands
Flask-Commands is a local-first CLI tool that scaffolds Flask projects and keeps generating views, routes, controllers, and models for you so you can stay in flow. This is still very much in a beta stage, so try it out at your own risk.
Getting Started
Flask-Commands bundles a few opinionated conveniences:
flask newbootstraps a ready-to-run Flask project with virtualenv, dotenv, Tailwind wiring, and optional SQLite + migrations.flask make:viewgenerates HTML views and can optionally add controllers, routes/blueprints, and SQLAlchemy models to match.
The goal is to remove the 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.
pip install Flask-Commands
The published console script is
flask. If you have a clash with Flask’s own CLI, run withpython -m flask_commands.cli ...or rename the script inpyproject.toml.
Quick Start
flask new myproject # add --no-db if you want to skip SQLite/migrations
cd myproject
source venv/bin/activate
flask run --debug # or ./run.sh on macOS to open terminals + Tailwind watcher
Add a first page with controller and route wiring:
flask make:view posts.index -cr
flask make:view admin.users.show -cr # nested example
Tailwind is installed automatically when npm is available; otherwise the tool skips it with a warning.
Commands
flask new
After installing Flask-Commands globally, you’ll have access to a new command called flask, which lets you quickly scaffold Flask applications from the terminal.
flask new myproject
Once the command completes, you’ll see a new directory called myproject/ that contains everything you need to get a Flask application up and running.
What you get:
- A Python virtual environment
venv/with core Flask dependencies pre-installed and listed inrequirements.txt. - When using
--db(enabled by default unless--no-dbis specified), the following are also included:- Flask-Migrate
- Flask-SQLAlchemy
- A seeded SQLite database with a users table
- An initial migration already applied
- A blueprint-based application skeleton under
app/, organized by responsibility:- Model
app/models/defining all your application’s data models/structure along with their methods. - View
app/templates/containing all HTML templates (including macros/components) used by the application. - Controller
app/controllers/housing controller classes responsible for the logic to gather and serve the requested data. - URL
app/routes/declaring URL paths and connecting them to controllers.
- Model
- The project entry point at
run.py. - Centralized configuration files under
config/. - If
npmis installed, a Tailwind-ready static asset pipeline atapp/static/src/, including npm scripts for watching and building CSS. - Environment configuration files:
.env.env.example
- A default blueprint named
mains, defined inapp/__init__.py:- Routes at
app/routes/mains - A controller at
app/controllers/main_controllernamedMainController - A starter “Hello World” template at
app/templates/mains/index.html
- Routes at
- A macOS-friendly helper script
run.shfor starting the application with a single command:
./run.sh
You can review this structure directly in the Flask-Commands source under flask_commands/project.
flask make:view
Generates template files under app/templates/ from dotted paths (for example, posts.index maps to app/templates/posts/index.html). Optional flags wire up matching components:
-c/--generate-controlleror--controller NAMEcreates or extends the controller class.-r/--generate-routeor--route PATHadds blueprint routes (CRUD verbs inferred when possible).-m/--generate-modelor--model NAMEseeds a SQLAlchemy model and import stub.
Examples:
flask make:view button # view-only snippet
flask make:view posts.index -crm # view + controller + route + model
flask make:view posts.show --route /posts/<int:post_id> --controller PostController
Contributing
I’m keeping development closed for now, but feedback is welcome. Please open an issue for bugs or ideas. License: MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask_commands-0.1.8.tar.gz.
File metadata
- Download URL: flask_commands-0.1.8.tar.gz
- Upload date:
- Size: 22.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.14.0 Darwin/20.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e7003a51f9666874cc01ce83d6961a29d4051d31a7a972e9ac1fc79558a8ab8
|
|
| MD5 |
6dccee03e731bf2964e3ee5989ed0a1e
|
|
| BLAKE2b-256 |
d5e636c2429076126915506e12e91e19e6d306edaf6c763aa32275fe9deaf2ab
|
File details
Details for the file flask_commands-0.1.8-py3-none-any.whl.
File metadata
- Download URL: flask_commands-0.1.8-py3-none-any.whl
- Upload date:
- Size: 31.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.14.0 Darwin/20.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0ea2f1b75a52d61270926c6181983fb38c8403e3a9a29e9984e84350c4f7bdd
|
|
| MD5 |
4fe0ae79f486c382ae7430f017aae921
|
|
| BLAKE2b-256 |
fb74b17b0d7bf0a1d283316ccd0337b1dd5a9d4e0bd1b87293a00b9eb960a6e5
|