Add Sentry error integration option
This commit is contained in:
parent
75e7385968
commit
4b4032be6f
@ -32,6 +32,12 @@ class PostAdmin(admin.ModelAdmin):
|
||||
def object_json(self, instance):
|
||||
return instance.to_ap()
|
||||
|
||||
def has_add_permission(self, request, obj=None):
|
||||
"""
|
||||
Disables admin creation of posts as it will skip steps
|
||||
"""
|
||||
return False
|
||||
|
||||
|
||||
@admin.register(TimelineEvent)
|
||||
class TimelineEventAdmin(admin.ModelAdmin):
|
||||
|
@ -14,3 +14,4 @@ django-htmx~=1.13.0
|
||||
django-storages[google,boto3]~=1.13.1
|
||||
whitenoise~=6.2.0
|
||||
sphinx~=5.3.0
|
||||
sentry-sdk~=1.11.0
|
||||
|
@ -77,3 +77,17 @@ STATOR_TOKEN = os.environ.get("TAKAHE_STATOR_TOKEN")
|
||||
# Error email recipients
|
||||
if "TAKAHE_ERROR_EMAILS" in os.environ:
|
||||
ADMINS = [("Admin", e) for e in os.environ["TAKAHE_ERROR_EMAILS"].split(",")]
|
||||
|
||||
# Sentry integration
|
||||
if "SENTRY_DSN" in os.environ:
|
||||
import sentry_sdk
|
||||
from sentry_sdk.integrations.django import DjangoIntegration
|
||||
|
||||
sentry_sdk.init(
|
||||
dsn=os.environ["SENTRY_DSN"],
|
||||
integrations=[
|
||||
DjangoIntegration(),
|
||||
],
|
||||
traces_sample_rate=1.0,
|
||||
send_default_pii=True,
|
||||
)
|
||||
|
6
templates/500.html
Normal file
6
templates/500.html
Normal file
@ -0,0 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Internal Server Error</h1>
|
||||
<p>Sorry about that.</p>
|
||||
{% endblock %}
|
@ -44,6 +44,12 @@ class IdentityAdmin(admin.ModelAdmin):
|
||||
def actor_json(self, instance):
|
||||
return instance.to_ap()
|
||||
|
||||
def has_add_permission(self, request, obj=None):
|
||||
"""
|
||||
Disables admin creation of identities as it will skip steps
|
||||
"""
|
||||
return False
|
||||
|
||||
|
||||
@admin.register(Follow)
|
||||
class FollowAdmin(admin.ModelAdmin):
|
||||
|
Reference in New Issue
Block a user