doc: update flask.md (#350)
This commit is contained in:
parent
c0da5393f5
commit
1ef8a1484d
@ -206,14 +206,14 @@ def getImg():
|
|||||||
```py
|
```py
|
||||||
from flask import Blueprint, abort, jsonify
|
from flask import Blueprint, abort, jsonify
|
||||||
|
|
||||||
# 定义Bp2,并定义url前缀为/vedio
|
# 定义Bp2,并定义url前缀为/video
|
||||||
Bp2 = Blueprint('vedioBlue', __name__, template_folder='templates', url_prefix='/vedio')
|
Bp2 = Blueprint('videoBlue', __name__, template_folder='templates', url_prefix='/video')
|
||||||
|
|
||||||
|
|
||||||
@Bp2.route('/getvedio')
|
@Bp2.route('/getvideo')
|
||||||
def getVedio():
|
def getvideo():
|
||||||
try:
|
try:
|
||||||
return jsonify(name="vedio", size="100GB")
|
return jsonify(name="video", size="100GB")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
abort(e)
|
abort(e)
|
||||||
```
|
```
|
||||||
@ -223,7 +223,7 @@ def getVedio():
|
|||||||
```py
|
```py
|
||||||
from flask import Flask, jsonify
|
from flask import Flask, jsonify
|
||||||
from lantu.img import Bp1
|
from lantu.img import Bp1
|
||||||
from lantu.vedio import Bp2
|
from lantu.video import Bp2
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@ -250,6 +250,6 @@ curl http://127.0.0.1:5000/
|
|||||||
curl http://127.0.0.1:5000/img/getimg
|
curl http://127.0.0.1:5000/img/getimg
|
||||||
>> {"name": "img", "size": "100KB"}
|
>> {"name": "img", "size": "100KB"}
|
||||||
|
|
||||||
curl http://127.0.0.1:5000/vedio/getvedio
|
curl http://127.0.0.1:5000/video/getvideo
|
||||||
>> {"name": "vedio", "size": "100GB"}
|
>> {"name": "video", "size": "100GB"}
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user