---
title: "Reporting HTTP Errors"
description: "Learn about reporting HTTP errors with Django."
url: https://docs.sentry.io/platforms/python/integrations/django/http_errors/
---

# Reporting HTTP Errors | Sentry for Python

If you want to report `404 Not Found` and other errors besides uncaught exceptions (`500 Internal Server Error`) to Sentry, you can write your own Django view for those status codes. For example:

```python
# urls.py
handler404 = 'mysite.views.my_custom_page_not_found_view'

# views.py
import sentry_sdk
from django.http import HttpResponseNotFound

def my_custom_page_not_found_view(*args, **kwargs):
    sentry_sdk.capture_message("Page not found!", level="error")

    # return any response here, e.g.:
    return HttpResponseNotFound("Not found")
```

The error message you send to Sentry will have the usual request data attached.

For details about `capture_message()`, see the [API Documentation](https://getsentry.github.io/sentry-python/api.html#sentry_sdk.api.capture_message).

Refer to [Customizing Error Views](https://docs.djangoproject.com/en/3.0/topics/http/views/#customizing-error-views) from the Django documentation for more information. You can also view our [troubleshooting information](https://docs.sentry.io/platforms/python/troubleshooting.md).
