结构
app/main.py
# -*- coding: utf-8 -*-
# by dl
from app.app.main.views import *
from app.app.app01.views import *
from app.app.app02.views import *
from flask import Flask
app = Flask(__name__)
app.register_blueprint(main)
app.register_blueprint(main, url_prefix='/index')
app.register_blueprint(app01, url_prefix='/app01')
app.register_blueprint(app02, url_prefix='/app02')
app.register_blueprint(app01, url_prefix='/app03')
app.register_blueprint(app02, url_prefix='/app04')
app.register_blueprint(app02)
if __name__ == '__main__':
app.run()
app/app01/views.py
# -*- coding: utf-8 -*-
# by dl
from flask import Blueprint
app01 = Blueprint('app01', __name__)
@app01.route('/')
def show():
return 'app01.hello'
app/app02/views.py
# -*- coding: utf-8 -*-
# by dl
from flask import Blueprint
app02 = Blueprint('app02', __name__)
@app02.route('/')
def show():
return 'app02.hello'
app/main/views.py
# -*- coding: utf-8 -*-
# by dl
from flask import Blueprint
main = Blueprint('main', __name__)
@main.route('/')
def show():
return 'main.hello'