__init__.py.vm 816 B

1234567891011121314151617181920212223
  1. # -*- coding: utf-8 -*-
  2. # @Module: {{ table.module_name }}
  3. # @Author: {{ table.function_author }}
  4. def init_app(app):
  5. """
  6. 初始化模块,注册蓝图
  7. Args:
  8. app: Flask应用实例
  9. """
  10. # 导入 controller 模块,自动注册所有蓝图
  11. {%- if tables %}
  12. {%- for table in tables %}
  13. # 使用 pythonModelName 生成 Python 导入路径
  14. from {{ get_import_path(table.package_name, '', 'controller') }} import {{ underscore(table.class_name) }}
  15. app.register_blueprint({{ underscore(table.class_name) }})
  16. {%- endfor %}
  17. {%- else %}
  18. # 使用 pythonModelName 生成 Python 导入路径
  19. from {{ get_import_path(table.package_name, '', 'controller') }} import {{ underscore(table.class_name) }}
  20. app.register_blueprint({{ underscore(table.class_name) }})
  21. {%- endif %}