Добавил Sentry

This commit is contained in:
Viner Abubakirov
2026-01-04 13:12:44 +05:00
parent db113ef5d1
commit aca3931abd
6 changed files with 52 additions and 1 deletions

View File

@@ -14,3 +14,5 @@ DB_USER=""
DB_PASSWORD=""
DB_HOST=""
DB_PORT=""
SENTRY_DSN=""

View File

@@ -1,10 +1,11 @@
from django.urls import path
from core.views import index
from core.views import index, sentry_debug
app_name = "index"
urlpatterns = [
path("", index, name="main_index"),
path("sentry-debug/", sentry_debug, name="sentry_debug"),
]

View File

@@ -3,3 +3,7 @@ from django.shortcuts import render
def index(request, *args, **kwargs):
return render(request, "index.html")
def sentry_debug(request):
division_by_zero = 1 / 0 # noqa

View File

@@ -182,3 +182,17 @@ AXES_COOLOFF_TIME = 0.25 # in hours
AXES_LOCK_OUT_AT_FAILURE = True
AXES_VERBOSE = True
AXES_LOCKOUT_PARAMETERS = [["ip_address", "user_agent"]]
# Sentry Configuration
SENTRY_DSN = os.getenv("SENTRY_DSN", "")
if SENTRY_DSN and not DEBUG:
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
sentry_sdk.init(
dsn=SENTRY_DSN,
integrations=[DjangoIntegration()],
traces_sample_rate=1.0,
send_default_pii=True
)

View File

@@ -13,5 +13,6 @@ dependencies = [
"pillow>=12.1.0",
"psycopg[binary]>=3.3.2",
"python-dotenv>=1.2.1",
"sentry-sdk[django]>=2.48.0",
"whitenoise>=6.11.0",
]

29
uv.lock generated
View File

@@ -39,6 +39,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/6e/a1/78c50c437fdf17369adeae275445f40f51029888911923ace37523db4c02/botocore-1.42.21-py3-none-any.whl", hash = "sha256:6b59973a3ba8c3cfd5123f2656fef2339beee9f6483b8bc12bb00c5453ea2c6d", size = 14550712, upload-time = "2026-01-03T00:58:48.653Z" },
]
[[package]]
name = "certifi"
version = "2026.1.4"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/e0/2d/a891ca51311197f6ad14a7ef42e2399f36cf2f9bd44752b3dc4eab60fdc5/certifi-2026.1.4.tar.gz", hash = "sha256:ac726dd470482006e014ad384921ed6438c457018f4b3d204aea4281258b2120", size = 154268, upload-time = "2026-01-04T02:42:41.825Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/e6/ad/3cc14f097111b4de0040c83a525973216457bbeeb63739ef1ed275c1c021/certifi-2026.1.4-py3-none-any.whl", hash = "sha256:9943707519e4add1115f44c2bc244f782c0249876bf51b6599fee1ffbedd685c", size = 152900, upload-time = "2026-01-04T02:42:40.15Z" },
]
[[package]]
name = "django"
version = "6.0"
@@ -112,6 +121,7 @@ dependencies = [
{ name = "pillow" },
{ name = "psycopg", extra = ["binary"] },
{ name = "python-dotenv" },
{ name = "sentry-sdk", extra = ["django"] },
{ name = "whitenoise" },
]
@@ -125,6 +135,7 @@ requires-dist = [
{ name = "pillow", specifier = ">=12.1.0" },
{ name = "psycopg", extras = ["binary"], specifier = ">=3.3.2" },
{ name = "python-dotenv", specifier = ">=1.2.1" },
{ name = "sentry-sdk", extras = ["django"], specifier = ">=2.48.0" },
{ name = "whitenoise", specifier = ">=6.11.0" },
]
@@ -274,6 +285,24 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/fc/51/727abb13f44c1fcf6d145979e1535a35794db0f6e450a0cb46aa24732fe2/s3transfer-0.16.0-py3-none-any.whl", hash = "sha256:18e25d66fed509e3868dc1572b3f427ff947dd2c56f844a5bf09481ad3f3b2fe", size = 86830, upload-time = "2025-12-01T02:30:57.729Z" },
]
[[package]]
name = "sentry-sdk"
version = "2.48.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "certifi" },
{ name = "urllib3" },
]
sdist = { url = "https://files.pythonhosted.org/packages/40/f0/0e9dc590513d5e742d7799e2038df3a05167cba084c6ca4f3cdd75b55164/sentry_sdk-2.48.0.tar.gz", hash = "sha256:5213190977ff7fdff8a58b722fb807f8d5524a80488626ebeda1b5676c0c1473", size = 384828, upload-time = "2025-12-16T14:55:41.722Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/4d/19/8d77f9992e5cbfcaa9133c3bf63b4fbbb051248802e1e803fed5c552fbb2/sentry_sdk-2.48.0-py2.py3-none-any.whl", hash = "sha256:6b12ac256769d41825d9b7518444e57fa35b5642df4c7c5e322af4d2c8721172", size = 414555, upload-time = "2025-12-16T14:55:40.152Z" },
]
[package.optional-dependencies]
django = [
{ name = "django" },
]
[[package]]
name = "six"
version = "1.17.0"