flask admin cli¶
A CLI application to create Flask Admin instances.
Installation¶
pip install flask-admin-cli
Usage¶
To get a list of examples you can run, and follow the instructions
flask-admin list-examples
To get a list of the original examples you can run, and follow the instructions
flask-admin list-original-examples
API¶
Main API
This file has the main functions to check and clone remote git repos.
clone_repo(branch=None, dest_dir=None)
¶
Clone the selected repo
Parameters:
Name | Type | Description | Default |
---|---|---|---|
branch |
str
|
remote branch to clone. |
None
|
dest_dir |
str
|
directory name inside the project. |
None
|
Raises:
Type | Description |
---|---|
InvalidParamsException
|
some of the parameters are invalid |
FileExistsError
|
the |
InvalidBranchException
|
the |
Returns:
Type | Description |
---|---|
True
|
True |
Source code in flask_admin_cli/api.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
cross_check(dest_dir, branch)
¶
Pre-flight checks
Verifies the environment
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dest_dir |
str
|
directory name inside the project. |
required |
branch |
str
|
remote branch to clone. |
required |
Raises:
Type | Description |
---|---|
InvalidParamsException
|
some of the parameters are invalid |
FileExistsError
|
the |
InvalidBranchException
|
the |
Source code in flask_admin_cli/api.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
CLI¶
CLI Application
Available Commands
- list-original-examples: To get a list of the original examples provided by Flask-Admin
- list-examples: To get a list of available apps for your project.
- new_app: creates an app
Examples:
>>> flask-admin list-examples
>>> flask-admin list-original-examples
list_examples()
¶
Lists all available examples.
All these examples are made by us.
Source code in flask_admin_cli/cli.py
33 34 35 36 37 38 39 40 41 42 43 44 |
|
list_original_examples()
¶
Lists all the original examples made by the Flask-Admin team.
Source code in flask_admin_cli/cli.py
22 23 24 25 26 27 28 29 30 |
|
new_app(app, dest_dir)
¶
Flask-Admin app as a Flask app
Source code in flask_admin_cli/cli.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|