diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/Pipfile | 2 | ||||
-rw-r--r-- | python/Pipfile.lock | 2 | ||||
-rw-r--r-- | python/fatcat_web/__init__.py | 4 | ||||
-rw-r--r-- | python/web_config.py | 12 |
4 files changed, 18 insertions, 2 deletions
diff --git a/python/Pipfile b/python/Pipfile index 2ec39901..5631e256 100644 --- a/python/Pipfile +++ b/python/Pipfile @@ -20,7 +20,7 @@ pg-view = "*" [packages] Flask = "*" requests = "*" -raven = "*" +raven = { extras = ['flask'], version = "*" } flask-uuid = "*" flask-debugtoolbar = "*" pykafka = "*" diff --git a/python/Pipfile.lock b/python/Pipfile.lock index e56a56cf..282c1740 100644 --- a/python/Pipfile.lock +++ b/python/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "462a724ea2ac6bbc244cf86523f5ae4f08b9e949fc176699d9f8a0cea5a81290" + "sha256": "9c98caeb32fe7ebb0e5c401994edfee5ea34d6832f5465070ff4a2f447f4b4b4" }, "pipfile-spec": 6, "requires": { diff --git a/python/fatcat_web/__init__.py b/python/fatcat_web/__init__.py index 8f487181..3c790e7a 100644 --- a/python/fatcat_web/__init__.py +++ b/python/fatcat_web/__init__.py @@ -2,6 +2,7 @@ from flask import Flask from flask_uuid import FlaskUUID from flask_debugtoolbar import DebugToolbarExtension +from raven.contrib.flask import Sentry from web_config import Config import fatcat_client @@ -11,6 +12,9 @@ app.config.from_object(Config) toolbar = DebugToolbarExtension(app) FlaskUUID(app) +# Grabs sentry config from SENTRY_DSN environment variable +sentry = Sentry(app) + conf = fatcat_client.Configuration() conf.host = "http://localhost:9411/v0" api = fatcat_client.DefaultApi(fatcat_client.ApiClient(conf)) diff --git a/python/web_config.py b/python/web_config.py index 8e177f77..8449aff5 100644 --- a/python/web_config.py +++ b/python/web_config.py @@ -10,6 +10,7 @@ import scripts. """ import os +import raven import subprocess basedir = os.path.abspath(os.path.dirname(__file__)) @@ -22,6 +23,17 @@ class Config(object): ELASTICSEARCH_BACKEND = os.environ.get("ELASTICSEARCH_BACKEND", default="http://localhost:9200") ELASTICSEARCH_INDEX = os.environ.get("ELASTICSEARCH_INDEX", default="fatcat") + try: + git_release = raven.fetch_git_sha(os.path.dirname(os.pardir)) + except Exception as e: + print("WARNING: couldn't set sentry git release automatically: " + str(e)) + git_release = None + SENTRY_CONFIG = { + #'include_paths': ['fatcat_web', 'fatcat_client', 'fatcat_tools'], + 'release': git_release, + 'fatcat_domain': FATCAT_DOMAIN, + } + # "Event more verbose" debug options. SECRET_KEY is bogus. #SQLALCHEMY_ECHO = True #SECRET_KEY = "kuhy0284hflskjhg01284" |