Cheat Sheet#
Not every visit to the documentation needs to be a full lesson. Sometimes you just want the command pattern, the flag, and a little reassurance that you are not inventing a workflow that makes no sense.
Naming Conventions#
Views use dotted names and follow plural resource naming (for example,
posts.comments.images.showorcomponents.buttons).Controllers use PascalCase (Upper CamelCase) and are singular, ending in
Controller(for example,RecipeCommentController).Models use PascalCase (Upper CamelCase) and are singular (for example,
Recipe,Comment,Image).
Common Patterns#
Pattern |
What it does |
|---|---|
|
Scaffold a new Flask project with a database and migrations. |
|
Scaffold a Flask project without the database packages, models, or migrations. |
|
Create a template only. |
|
Create a template and wire a route and controller. |
|
Keep the template under |
|
Start a recipe resource with a list page, route, controller, and model. |
|
Add a detail page to the existing recipe resource. |
|
Add a |
|
Add a |
|
Create a nested comments resource under recipes. |
|
Generate RESTful controller methods, routes, and templates for recipes. |
|
Create the controller and infer a matching model from the controller name. |
|
Keep a multi-word model name together while generating RESTful scaffolding. |
|
Force the nested model interpretation for a controller-first |
|
Create and register a single model scaffold. |
|
Create the model and scaffold the controller, routes, and templates around it. |
|
Force a flat RESTful structure for a model name that could also be nested. |
|
Force a nested RESTful structure for a model name that could also be flat. |