Skip to content

Commit 8ab8969

Browse files
author
legolas.zhan
committed
doc: add cli help info
1 parent dbc65af commit 8ab8969

File tree

1 file changed

+54
-1
lines changed

1 file changed

+54
-1
lines changed

README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,47 @@ pipenv install -r requirements.txt --pre && pipenv install --dev pytest pytest-c
3131
pipenv shell
3232
```
3333

34-
## Run server:
34+
## flask cli:
35+
36+
```
37+
(demo) ➜ FLASK_APP=app.run:app flask
38+
Usage: flask [OPTIONS] COMMAND [ARGS]...
39+
40+
A general utility script for Flask applications.
41+
42+
An application to load must be given with the '--app' option, 'FLASK_APP'
43+
environment variable, or with a 'wsgi.py' or 'app.py' file in the current
44+
directory.
45+
46+
Options:
47+
-e, --env-file FILE Load environment variables from this file. python-
48+
dotenv must be installed.
49+
-A, --app IMPORT The Flask application or factory function to load, in
50+
the form 'module:name'. Module can be a dotted import
51+
or file path. Name is not required if it is 'app',
52+
'application', 'create_app', or 'make_app', and can be
53+
'name(args)' to pass arguments.
54+
--debug / --no-debug Set debug mode.
55+
--version Show the Flask version.
56+
--help Show this message and exit.
57+
58+
Commands:
59+
db Perform database migrations.
60+
routes Show the routes for the app.
61+
run Run a development server.
62+
shell Runs a shell in the app context.
63+
```
64+
65+
```
66+
(demo) ➜ FLASK_APP=app.run:app flask routes
67+
Endpoint Methods Rule
68+
------------ ------- -----------------------
69+
static GET /static/<path:filename>
70+
tools.option GET /api/options
71+
tools.ping GET /api/ping
72+
```
73+
74+
## Run server
3575

3676
```
3777
(demo) ➜ flask -A app/run.py run
@@ -41,6 +81,13 @@ WARNING: This is a development server. Do not use it in a production deployment.
4181
* Running on http://127.0.0.1:5000
4282
```
4383

84+
```
85+
➜ ~ curl http://127.0.0.1:5000/api/ping
86+
{"ping":"ok"}
87+
➜ ~ curl http://127.0.0.1:5000/api/options
88+
{}
89+
```
90+
4491
## Run test:
4592

4693
```
@@ -92,4 +139,10 @@ TOTAL 126 6 95%
92139

93140
```
94141
hobbit --help
142+
```
143+
144+
# dev
145+
146+
```
147+
pip install "hobbit-core[hobbit,hobbit_core]=={version}" --pre --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/
95148
```

0 commit comments

Comments
 (0)