From 4195bcbbd0216aa24c8ea2355218b17985dc5387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B4=94=E4=B8=BA=E4=B9=8B?= <560397@gree.com.cn> Date: Tue, 21 Nov 2023 13:48:38 +0800 Subject: [PATCH] Update project --- application/constants/__init__.py | 2 +- application/extensions/init_consul.py | 2 +- application/extensions/init_cors.py | 14 ++++++++++---- application/extensions/init_dotenv.py | 2 +- application/extensions/init_elasticsearch.py | 17 ++++++++++++----- application/extensions/init_logger.py | 16 +++++++++++----- application/extensions/init_sqlalchemy.py | 2 +- application/libs/config/__init__.py | 2 +- application/libs/flask_apscheduler/__init__.py | 2 +- application/libs/flask_consul/__init__.py | 2 +- application/models/__init__.py | 2 +- 11 files changed, 41 insertions(+), 22 deletions(-) diff --git a/application/constants/__init__.py b/application/constants/__init__.py index 8e0bfb4..f45b4df 100644 --- a/application/constants/__init__.py +++ b/application/constants/__init__.py @@ -6,7 +6,7 @@ # @Author : StudentCWZ # @Email : StudentCWZ@outlook.com # @Date : 2023/11/4 15:08 -# @File : __init__.py.py +# @File : __init__.py # @Description : """ diff --git a/application/extensions/init_consul.py b/application/extensions/init_consul.py index c12d1b6..8ff99e5 100644 --- a/application/extensions/init_consul.py +++ b/application/extensions/init_consul.py @@ -7,7 +7,7 @@ # @Email : StudentCWZ@outlook.com # @Date : 2023/11/21 10:01 # @File : init_consul.py -# @Description : +# @Description : Initializes the FlaskConsulService for a Flask application. """ # Import built-in modules diff --git a/application/extensions/init_cors.py b/application/extensions/init_cors.py index 0f53f65..70325ed 100644 --- a/application/extensions/init_cors.py +++ b/application/extensions/init_cors.py @@ -7,7 +7,7 @@ # @Email : StudentCWZ@outlook.com # @Date : 2023/11/4 15:43 # @File : init_cors.py -# @Description : +# @Description : Initializes the Flask CORS extension for a Flask application. """ from flask import Flask @@ -16,9 +16,15 @@ from flask_cors import CORS def init_cors(app: Flask) -> None: """ - Initialize the dynaconf extension + Initializes the Flask CORS extension for a Flask application. - :param app: flask.Flask application instance - :return: None + The CORS extension allows for cross-origin resource sharing, enabling + requests from different domains to the Flask application. + + Args: + app (Flask): The Flask application. + + Returns: + None """ CORS(app) diff --git a/application/extensions/init_dotenv.py b/application/extensions/init_dotenv.py index bef1f58..39f6b31 100644 --- a/application/extensions/init_dotenv.py +++ b/application/extensions/init_dotenv.py @@ -7,7 +7,7 @@ # @Email : StudentCWZ@outlook.com # @Date : 2023/11/21 10:51 # @File : init_dotenv.py -# @Description : +# @Description : Initializes the dotenv extension for the application. """ # Import standard library modules diff --git a/application/extensions/init_elasticsearch.py b/application/extensions/init_elasticsearch.py index 20c2161..ca3aef4 100644 --- a/application/extensions/init_elasticsearch.py +++ b/application/extensions/init_elasticsearch.py @@ -7,12 +7,11 @@ # @Email : StudentCWZ@outlook.com # @Date : 2023/10/28 18:16 # @File : init_elasticsearch.py -# @Description : +# @Description : Initializes the FlaskElasticsearch extension for a Flask application. """ from flask import Flask - from application.libs import FlaskElasticsearch es = FlaskElasticsearch() @@ -20,9 +19,17 @@ es = FlaskElasticsearch() def init_elasticsearch(app: Flask) -> None: """ - Initialize the flask_elasticsearch extension + Initializes the FlaskElasticsearch extension for a Flask application. + + Elasticsearch is a distributed, RESTful search and analytics engine capable of + addressing a growing number of use cases. As the heart of the Elastic Stack, + it centrally stores your data for lightning fast search, fine‑tuned relevancy, + and powerful analytics that scale with ease. + + Args: + app (Flask): The Flask application. - :param app: flask.Flask application instance - :return: None + Returns: + None """ es.init_app(app) diff --git a/application/extensions/init_logger.py b/application/extensions/init_logger.py index 598f56c..852b4e5 100644 --- a/application/extensions/init_logger.py +++ b/application/extensions/init_logger.py @@ -7,19 +7,25 @@ # @Email : StudentCWZ@outlook.com # @Date : 2023/10/28 18:16 # @File : init_logger.py -# @Description : +# @Description : Initializes the FlaskLoguru service for a Flask application. """ from flask import Flask - from application.libs import FlaskLoguru def init_logger(app: Flask) -> None: """ - Initialize the dynaconf extension + Initializes the FlaskLoguru service for a Flask application. + + Loguru is a library which aims to bring enjoyable logging in Python. + It provides a nice and clean interface over logging's complex API + to ease the process of logging. + + Args: + app (Flask): The Flask application. - :param app: flask.Flask application instance - :return: None + Returns: + None """ FlaskLoguru(app) diff --git a/application/extensions/init_sqlalchemy.py b/application/extensions/init_sqlalchemy.py index 1b17461..91f4a62 100644 --- a/application/extensions/init_sqlalchemy.py +++ b/application/extensions/init_sqlalchemy.py @@ -7,7 +7,7 @@ # @Email : StudentCWZ@outlook.com # @Date : 2023/10/28 22:01 # @File : init_sqlalchemy.py -# @Description : +# @Description : Initializes the SQLAlchemy extension for a Flask application. """ from flask import Flask diff --git a/application/libs/config/__init__.py b/application/libs/config/__init__.py index 0df1d01..4dbdbb7 100644 --- a/application/libs/config/__init__.py +++ b/application/libs/config/__init__.py @@ -6,7 +6,7 @@ # @Author : StudentCWZ # @Email : StudentCWZ@outlook.com # @Date : 2023/10/28 15:06 -# @File : __init__.py.py +# @File : __init__.py # @Description : """ diff --git a/application/libs/flask_apscheduler/__init__.py b/application/libs/flask_apscheduler/__init__.py index e572e2b..f5ac676 100644 --- a/application/libs/flask_apscheduler/__init__.py +++ b/application/libs/flask_apscheduler/__init__.py @@ -6,7 +6,7 @@ # @Author : StudentCWZ # @Email : StudentCWZ@outlook.com # @Date : 2023/11/11 15:15 -# @File : __init__.py.py +# @File : __init__.py # @Description : """ diff --git a/application/libs/flask_consul/__init__.py b/application/libs/flask_consul/__init__.py index 6be0535..d28b3e7 100644 --- a/application/libs/flask_consul/__init__.py +++ b/application/libs/flask_consul/__init__.py @@ -6,7 +6,7 @@ # @Author : StudentCWZ # @Email : StudentCWZ@outlook.com # @Date : 2023/11/21 09:10 -# @File : __init__.py.py +# @File : __init__.py # @Description : """ diff --git a/application/models/__init__.py b/application/models/__init__.py index c854a9f..ebf1034 100644 --- a/application/models/__init__.py +++ b/application/models/__init__.py @@ -6,7 +6,7 @@ # @Author : StudentCWZ # @Email : StudentCWZ@outlook.com # @Date : 2023/10/28 22:12 -# @File : __init__.py.py +# @File : __init__.py # @Description : """ -- GitLab