其他分享
首页 > 其他分享> > 九十:CMS系统之项目结构

九十:CMS系统之项目结构

作者:互联网

 

目录结构

cms模块

from flask import Blueprint

bp = Blueprint('cms', __name__, url_prefix='/cms')


@bp.route('/')
def index():
return 'cms index'

from .views import bp

common模块

from flask import Blueprint

bp = Blueprint('common', __name__, url_prefix='/common')


@bp.route('/')
def index():
return 'common index'

from .views import bp

front模块

from flask import Blueprint

bp = Blueprint('front', __name__)


@bp.route('/')
def index():
return 'front index'

from .views import bp

config

主文件

from flask import Flask
from apps.cms import bp as cms_bp
from apps.common import bp as common_bp
from apps.front import bp as front_bp
import config

app = 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)

运行

 

标签:__,index,cms,系统,九十,common,import,bp,CMS
来源: https://www.cnblogs.com/zhongyehai/p/11901204.html