summaryrefslogtreecommitdiffstats
path: root/app.py
diff options
context:
space:
mode:
Diffstat (limited to 'app.py')
-rw-r--r--app.py35
1 files changed, 19 insertions, 16 deletions
diff --git a/app.py b/app.py
index 3c8446f4..94b1c2af 100644
--- a/app.py
+++ b/app.py
@@ -36,17 +36,24 @@ __VERSION__ = VERSION
AVAILABLE_LOCALES = ["fr", "fr_FR", "en", "en_US", "pl"]
try:
- from raven.contrib.flask import Sentry
- import raven
+ import sentry_sdk
+ from sentry_sdk.integrations.flask import FlaskIntegration as SentryFlaskIntegration
+ from sentry_sdk.integrations.celery import CeleryIntegration as SentryCeleryIntegration
- print(" * Sentry support loaded")
+ print(" * Sentry Flask/Celery support have been loaded")
HAS_SENTRY = True
except ImportError:
- print(" * No Sentry support")
+ print(" * No Sentry Flask/Celery support available")
HAS_SENTRY = False
mail = Mail()
+GIT_VERSION = ""
+gitpath = os.path.join(os.getcwd(), ".git")
+if os.path.isdir(gitpath):
+ GIT_VERSION = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])
+ if GIT_VERSION:
+ GIT_VERSION = GIT_VERSION.strip().decode("UTF-8")
def make_celery(remoulade):
celery = Celery(remoulade.import_name, broker=remoulade.config["CELERY_BROKER_URL"])
@@ -78,9 +85,12 @@ def create_app(config_filename="config.py", app_name=None, register_blueprints=T
app.jinja_env.globals.update(duration_song_human=duration_song_human)
if HAS_SENTRY:
- app.config["SENTRY_RELEASE"] = raven.fetch_git_sha(os.path.dirname(__file__))
- sentry = Sentry(app, dsn=app.config["SENTRY_DSN"]) # noqa: F841
- print(" * Sentry support activated")
+ sentry_sdk.init(
+ app.config["SENTRY_DSN"],
+ integrations=[SentryFlaskIntegration(), SentryCeleryIntegration()],
+ release=f"{VERSION} ({GIT_VERSION})"
+ )
+ print(" * Sentry Flask/Celery support activated")
print(" * Sentry DSN: %s" % app.config["SENTRY_DSN"])
if app.config["DEBUG"] is True:
@@ -136,13 +146,6 @@ def create_app(config_filename="config.py", app_name=None, register_blueprints=T
db.session.add(actor)
db.session.commit()
- git_version = ""
- gitpath = os.path.join(os.getcwd(), ".git")
- if os.path.isdir(gitpath):
- git_version = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])
- if git_version:
- git_version = git_version.strip().decode("UTF-8")
-
@babel.localeselector
def get_locale():
# if a user is logged in, use the locale from the user settings
@@ -169,8 +172,8 @@ def create_app(config_filename="config.py", app_name=None, register_blueprints=T
cfg = {
"REEL2BITS_VERSION_VER": VERSION,
- "REEL2BITS_VERSION_GIT": git_version,
- "REEL2BITS_VERSION": "{0} ({1})".format(VERSION, git_version),
+ "REEL2BITS_VERSION_GIT": GIT_VERSION,
+ "REEL2BITS_VERSION": "{0} ({1})".format(VERSION, GIT_VERSION),
"app_name": _config.app_name,
"app_description": _config.app_description,
}