zoukankan      html  css  js  c++  java
  • Flask实例化配置

    template_folder :指定模板存放路径,默认值:temolates

    from flask import Flask, url_for
    
    app = Flask(__name__,template_folder="tem")
    
    
    @app.route("/index")
    def index():
        return "光临"
    
    if __name__ == '__main__':
        app.run(debug=True)

    static_folder和static_url_path

    from flask import Flask, url_for
    
    app = Flask(__name__,static_folder="statics",static_url_path="/static")
    #static_folder="statics", # 指定静态文件存放路径 默认值:static #static_url_path="/static" # 指定静态文件访问路径 默认值:- "/{static_folder}" @app.route("/index") def index(): return "光临" if __name__ == '__main__': app.run(debug=True)

    以下为不常用配置,可以使用nginx实现

    static_host=None #远程静态文件存放服务器
    host_matching=False #为True:遵循主机位匹配 http://www.baidu.com/index
    subdomain_matching=False # True:严格遵循子域名访问subdomain - sub - 子域名 music.baidu.com/music.html 
  • 相关阅读:
    CF163E e-Government
    P2336 [SCOI2012]喵星球上的点名
    数据结构
    数字逻辑
    建筑制图与识图
    建筑施工
    电力系统分析
    现代物流基础
    电子商务网站设计与管理
    数字电子技术基础
  • 原文地址:https://www.cnblogs.com/wanglan/p/10559608.html
Copyright © 2011-2022 走看看