Skip to main content

A CLI tool for the FlaskMVC Starter Kit

Project description

Crafter

A CLI tool for rapidly building applications with FlaskMVC Starter Kit

Getting Started

  1. Create a project using FlaskMVC Starter Kit and install the dependencies (this installs Crafter as well)

Usage

  • the format of running commands with crafter is as follows:
crafter <command> <args>

Commands

model

Create a model with a name of post

crafter model --name post
  • generates post.py in app/models

controller

Create a controller with a name of post

crafter controller --name post
  • generates post_controller.py in app/controllers
  • generates a model if no model with given name is found

route

Create a route with a name of post

crafter route --name post
  • generates post_route.py in app/routes
  • generates a controller if no controller with given name is found
  • generates a model if no model with given name is found

relationship

Create a relationship between two models

  • type: [one_one, one_many, many_one, many_many]
  • models: model_1, model_2
crafter relationship --type one_one --models student contact
  • generates either models if no model with given names are found
  • creates a one-to-one relationship between student and contact
crafter relationship --type one_many --models knight sword
  • creates a one-to-many relationship between knight and sword (one knight has many swords)
  • if we swap the positions (--models sword knight) the relationship would be one sword has many knights, which may or may not be intended

many_one works the same way as one_many, just take note of the positions of the arguments

To create a many-to-many relationship, an additional argument is needed, the association

crafter relationship --type many_many --models wizard spell
Enter the association table between wizard and spell: spellbook
  • A bridging table named spellbook is created
  • if no input is given, default table name is {model_1}_{model_2} (in this case, wizard_spell)

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-mvc-crafter-0.1.1.tar.gz (6.7 kB view details)

Uploaded Source

File details

Details for the file flask-mvc-crafter-0.1.1.tar.gz.

File metadata

  • Download URL: flask-mvc-crafter-0.1.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.4

File hashes

Hashes for flask-mvc-crafter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f1b5fad53c56efd4687b74e3d5b55ccd51f67eefc438e5c130a7b233d6ef4a86
MD5 2bafb52e8a89bb045578a0182a213d68
BLAKE2b-256 d00f6984068487e9feb546c6d7a8c7d5db09033507bcea91c0ba490bb9cdad2d

See more details on using hashes here.

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