九十: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)

运行

 

posted @ 2019-11-20 21:55  向前走。  阅读(646)  评论(0编辑  收藏  举报