feat: use /threads module-provided cache
This commit is contained in:
parent
1c79c58ac6
commit
2ce604e376
2 changed files with 5 additions and 9 deletions
2
cache/cache.py
vendored
2
cache/cache.py
vendored
|
@ -1,2 +0,0 @@
|
||||||
from flask_caching import Cache
|
|
||||||
cache = Cache()
|
|
12
web.py
12
web.py
|
@ -1,23 +1,21 @@
|
||||||
from flask import Flask, send_from_directory
|
from flask import Flask, send_from_directory
|
||||||
import sentry_sdk
|
import sentry_sdk
|
||||||
import json
|
import json
|
||||||
from cache.cache import cache
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
app.config.from_file("config.json", load=json.load)
|
||||||
|
|
||||||
|
# /threads
|
||||||
try:
|
try:
|
||||||
from threads.threads import threads
|
from threads.threads import threads
|
||||||
app.register_blueprint(threads, url_prefix='/threads')
|
app.register_blueprint(threads, url_prefix='/threads')
|
||||||
print(' * Threads blueprint registered')
|
print(' * Threads blueprint registered')
|
||||||
|
from threads.cache import cache as thread_cache
|
||||||
|
print(' * Threads cache type: ' + app.config["CACHE_TYPE"])
|
||||||
|
thread_cache.init_app(app)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print(' ! Threads blueprint not found')
|
print(' ! Threads blueprint not found')
|
||||||
|
|
||||||
app.config.from_file("config.json", load=json.load)
|
|
||||||
|
|
||||||
# caching
|
|
||||||
print(' * Cache type: ' + app.config["CACHE_TYPE"])
|
|
||||||
cache.init_app(app)
|
|
||||||
|
|
||||||
# perf monitoring & error tracking
|
# perf monitoring & error tracking
|
||||||
sentry_config = app.config["SENTRY"]
|
sentry_config = app.config["SENTRY"]
|
||||||
print(' * Monitoring DSN: ' + sentry_config["dsn"])
|
print(' * Monitoring DSN: ' + sentry_config["dsn"])
|
||||||
|
|
Loading…
Reference in a new issue