Commit
·
676931e
1
Parent(s):
4263a3c
test: added simple test blueprint to test current blueprint/import system, moved jobs.json out of the app folder
Browse files- app/__init__.py +0 -0
- app/app.py +2 -2
- app/routes/__init__.py +1 -0
- app/routes/blueprint_test.py +4 -0
- app/routes/test.py +16 -0
- app/jobs.json → jobs.json +0 -0
app/__init__.py
ADDED
File without changes
|
app/app.py
CHANGED
@@ -6,7 +6,7 @@ import logging
|
|
6 |
from flask import Flask
|
7 |
from flask_apscheduler import APScheduler
|
8 |
from asgiref.wsgi import WsgiToAsgi
|
9 |
-
from routes import category_bp, summary_bp
|
10 |
|
11 |
@dataclass
|
12 |
class Config:
|
@@ -42,6 +42,7 @@ def create_app():
|
|
42 |
flask_app.config.from_object(Config())
|
43 |
flask_app.register_blueprint(summary_bp, url_prefix='/summary')
|
44 |
flask_app.register_blueprint(category_bp)
|
|
|
45 |
|
46 |
logging.basicConfig(
|
47 |
format='%(asctime)s - %(levelname)s - %(funcName)s - %(message)s')
|
@@ -53,7 +54,6 @@ def create_app():
|
|
53 |
return flask_app
|
54 |
|
55 |
app = create_app()
|
56 |
-
|
57 |
asgi_app = WsgiToAsgi(app)
|
58 |
|
59 |
if __name__ == '__main__':
|
|
|
6 |
from flask import Flask
|
7 |
from flask_apscheduler import APScheduler
|
8 |
from asgiref.wsgi import WsgiToAsgi
|
9 |
+
from routes import category_bp, summary_bp, test_bp
|
10 |
|
11 |
@dataclass
|
12 |
class Config:
|
|
|
42 |
flask_app.config.from_object(Config())
|
43 |
flask_app.register_blueprint(summary_bp, url_prefix='/summary')
|
44 |
flask_app.register_blueprint(category_bp)
|
45 |
+
flask_app.register_blueprint(test_bp)
|
46 |
|
47 |
logging.basicConfig(
|
48 |
format='%(asctime)s - %(levelname)s - %(funcName)s - %(message)s')
|
|
|
54 |
return flask_app
|
55 |
|
56 |
app = create_app()
|
|
|
57 |
asgi_app = WsgiToAsgi(app)
|
58 |
|
59 |
if __name__ == '__main__':
|
app/routes/__init__.py
CHANGED
@@ -3,3 +3,4 @@ from flask import Blueprint
|
|
3 |
|
4 |
category_bp = Blueprint("category", __name__)
|
5 |
summary_bp = Blueprint("summary", __name__)
|
|
|
|
3 |
|
4 |
category_bp = Blueprint("category", __name__)
|
5 |
summary_bp = Blueprint("summary", __name__)
|
6 |
+
test_bp = Blueprint("test", __name__)
|
app/routes/blueprint_test.py
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""This module sets up the main Blueprint for the Flask application."""
|
2 |
+
from flask import Blueprint
|
3 |
+
|
4 |
+
test_bp = Blueprint("test", __name__)
|
app/routes/test.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""This module defines the /test route for the Flask application."""
|
2 |
+
|
3 |
+
from blueprint_test import test_bp
|
4 |
+
from flask import jsonify
|
5 |
+
@test_bp.route('/test', methods=['GET'])
|
6 |
+
def test():
|
7 |
+
"""
|
8 |
+
Endpoint to check the health status of the application.
|
9 |
+
This route returns a JSON response with a message indicating the health
|
10 |
+
status of the application. It is typically used for monitoring purposes
|
11 |
+
to ensure the application is running as expected.
|
12 |
+
Returns:
|
13 |
+
Response: A JSON response with a "message" key set to "OK" and an HTTP
|
14 |
+
status code of 200.
|
15 |
+
"""
|
16 |
+
return jsonify({"message": "OK"}), 200
|
app/jobs.json → jobs.json
RENAMED
File without changes
|