lantu.py
from flask import Blueprint
route_lantu = Blueprint( "lantu_page",__name__)
@route_lantu.route("/index",methods=['GET' , 'POST'])
def index():
return "hello"
@route_lantu.route("/hello",methods=['GET' , 'POST'])
def hello():
return "hello_lantu"
app.py
from flask import Flask
from lantu import route_lantu
from commen.libs.UrlManafer import UrlManager
app = Flask(__name__)
#把lantu.py引入,"/path"是你定义的路径,所有带/path的请求都会路由到lantu.py
app.register_blueprint( route_lantu,url_prefix = "/path")
@app.route("/hello" , methods=['GET' , 'POST'])
def hello():
return "hello_lantu"
if __name__ == '__main__':
app.run(host='0.0.0.0',debug = True)