import os,utils
from flask import Flask

def basename_filter(path):
    return os.path.basename(path)

def create_app():
    # current_dir = os.path.dirname(os.path.abspath(__file__))
    # template_path = os.path.join(current_dir, 'templates')
    # web_app = Flask(__name__, template_folder=template_path)
    web_app = Flask(__name__)
    # 注册蓝图或其他初始化操作
    from .views_project import project_bp
    from .views_auth import auth_bp
    from .views_log import log_bp
    web_app.secret_key="1qwe2iwb3vber"

    web_app.register_blueprint(project_bp)
    web_app.register_blueprint(auth_bp)
    web_app.register_blueprint(log_bp)

    # 注册自定义过滤器
    web_app.jinja_env.filters['basename'] = basename_filter

    return web_app