blueprint实现子域名

1.ip地址和 localhost下面不能挂子域名

2.实现步骤

(1)新增blueprint,注册蓝图的时候,使用的参数是 subdomain

cms_bp = Blueprint('cms',__name__,subdomain='cms')

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

(2)将蓝图注册 到  主APP文件中的

from blueprints.cms import cms_bp

app.register_blueprint(cms_bp)
(3)  配置  server

app.config['SERVER_NAME'] = 'jd.com:5000'

现在可以就访问,cms.jd.com:5000

猜你喜欢

转载自blog.csdn.net/hebi123s/article/details/82381669