From bc46633af45d68c2200d68915c3227a3248003d2 Mon Sep 17 00:00:00 2001 From: Ayo Ayco Date: Sat, 18 May 2024 21:53:36 +0200 Subject: [PATCH] refactor: put threads blueprint in threads dir --- example_config.json | 5 +- threads/templates/threads.html | 437 +++++++++++++++++++++++++++++++++ web.py | 6 +- 3 files changed, 445 insertions(+), 3 deletions(-) create mode 100644 threads/templates/threads.html diff --git a/example_config.json b/example_config.json index e96a606..2a50b46 100644 --- a/example_config.json +++ b/example_config.json @@ -4,5 +4,8 @@ "traces_sample_rate": 1.0, "profiles_sample_rate": 1.0, "enable_tracing": true - } + }, + "CACHE_TYPE": "SimpleCache", + "CACHE_DEFAULT_TIMEOUT": 30, + "CACHE_KEY_PREFIX": "ayco_io" } diff --git a/threads/templates/threads.html b/threads/templates/threads.html new file mode 100644 index 0000000..ca894e4 --- /dev/null +++ b/threads/templates/threads.html @@ -0,0 +1,437 @@ + + + + + + {{ app.title }} + + {% if threads|length == 1 %} + + + {% else %} + + + {% endif %} + + + + + + + + + + + + +
+ +

{{ app.title }}

+

{{ app.description }}

+
+
+
+ Back +
+ + + Top +
+ + + diff --git a/web.py b/web.py index d7bb89e..35f56fb 100755 --- a/web.py +++ b/web.py @@ -3,7 +3,7 @@ from flask_caching import Cache import sentry_sdk import json from partials import partials -from threads import threads +from threads.threads import threads app = Flask(__name__) app.register_blueprint(partials, url_prefix='/p') @@ -12,9 +12,12 @@ app.config.from_file("config.json", load=json.load) # caching cache = Cache() +cache.init_app(app) +print(' * Cache type: ' + app.config["CACHE_TYPE"]) # perf monitoring & error tracking sentry_config = app.config["SENTRY"] +print(' * Monitoring DSN: ' + sentry_config["dsn"]) sentry_sdk.init( dsn=sentry_config["dsn"], traces_sample_rate=sentry_config["traces_sample_rate"], @@ -22,7 +25,6 @@ sentry_sdk.init( enable_tracing=sentry_config["enable_tracing"], ) - @app.route('/') def home(): return send_from_directory('dist', 'index.html')