九十:CMS系统之项目结构

怎甘沉沦 提交于 2019-12-05 03:08:48

 

目录结构

cms模块

from flask import Blueprintbp = Blueprint('cms', __name__, url_prefix='/cms')@bp.route('/')def index():    return 'cms index'

from .views import bp

common模块

from flask import Blueprintbp = Blueprint('common', __name__, url_prefix='/common')@bp.route('/')def index():    return 'common index'

from .views import bp

front模块

from flask import Blueprintbp = Blueprint('front', __name__)@bp.route('/')def index():    return 'front index'

from .views import bp

config

主文件

from flask import Flaskfrom apps.cms import bp as cms_bpfrom apps.common import bp as common_bpfrom apps.front import bp as front_bpimport configapp = Flask(__name__)app.config.from_object(config)app.register_blueprint(cms_bp)app.register_blueprint(common_bp)app.register_blueprint(front_bp)if __name__ == '__main__':    app.run(host='0.0.0.0', port=8888)

运行

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!