from flask import Blueprint,send_from_directory
from application import app
route_static = Blueprint(‘static’,name)
@route_static.route("/path:filename")
def index(filename):
app.logger.info(filename)
return send_from_directory(app.root_path + “/web/static/”,filename)
这是static部分
class Application( Flask ):
def int(self,import_name,template_folder=None,root_path=None):
super( Application,self).int(import_name,template_folder=template_folder,root_path=root_path,static_folder=None)
self.config.from_pyfile(‘config/base_setting.py’) #加载配置文件
if “ops_config” in os.environ:
self.config.from_pyfile(‘config/%_setting.py’%os.environ[‘ops_config’])#加载ops_config所定义的文件
db.init_app(self)
db=SQLAlchemy()
app=Application(name,template_folder=os.getcwd()+"/web/templates/",root_path=os.getcwd())
这是application部分
图片加载不出来