liuyuqi-dellpc 1 month ago
parent
commit
0dc35dc2be
5 changed files with 50 additions and 2 deletions
  1. 13 0
      .pre-commit-config.yaml
  2. 1 1
      gui/main.py
  3. 1 1
      main.py
  4. 6 0
      web/app.py
  5. 29 0
      web/apps/extensions/__init__.py

+ 13 - 0
.pre-commit-config.yaml

@@ -0,0 +1,13 @@
+repos:
+  - repo: https://github.com/charliermarsh/ruff-pre-commit
+    # Ruff version.
+    rev: 'v0.0.280'
+    hooks:
+      - id: ruff
+        args: [ --fix, --exit-non-zero-on-fix ]
+
+  - repo: https://github.com/psf/black
+    rev: 23.1.0
+    hooks:
+      - id: black
+

+ 1 - 1
gui/main.py

@@ -11,4 +11,4 @@ import os,sys,logging
 
 
 if __name__=='__main__':
-    pass
+    pass

+ 1 - 1
main.py

@@ -25,4 +25,4 @@ if __name__=='__main__':
                 value=i["value"]
                 github_api.set_update_github_secret(key, value)
     else:
-        print(f"account.json not found, current path: {current_run_path}")
+        print(f"account.json not found, current path: {current_run_path}")

+ 6 - 0
web/app.py

@@ -7,6 +7,12 @@
 @Desc    :   enter point
 """
 
+
+from apps import create_app
+
+app = create_app()
+
+
 if __name__=='__main__':
     from dotenv import load_dotenv
     import os

+ 29 - 0
web/apps/extensions/__init__.py

@@ -0,0 +1,29 @@
+from flask import Flask
+from .init_sqlalhemy import db, ma, init_databases
+from .init_upload import init_upload
+from .init_login import init_login_manager
+from .init_mail import init_mail
+from .init_csrf import init_csrf
+from .init_template_directives import init_template_directives
+# from flasgger import Swagger
+# from flask_siwadoc import SiwaDoc
+
+def init_extensions(app: Flask):
+    """初始化flask插件"""
+
+    init_login_manager(app)
+    init_databases(app)
+    init_template_directives(app)
+    init_mail(app)
+    init_upload(app)
+    # init_csrf(app)
+
+    # flask-cache
+    # init_cache(app)
+    init_docs(app=app)
+
+def init_docs(app: Flask):
+    """  """
+    # swagger = Swagger(app)
+    # siwa = SiwaDoc(app)
+    pass