Skip to main content

Report exceptions from Django to Google Stackdriver Error Reporting

Project description

dj-cloud-error: Django Google Cloud Error Reporting

https://img.shields.io/pypi/v/dj_cloud_error.svg https://img.shields.io/travis/prismaticd/dj-cloud-error.svg

Report exceptions from any Django site to Google Cloud Stackdriver Error Reporting

  • Free software: MIT license

Features

  • Report exceptions from any Django site to Google Cloud Stackdriver Error Reporting
  • Optional dependency on django-ipware for logging of IP addresses

Quickstart

  1. Configure your app to user Google Cloud project:
  • Enabled the Error Reporting api as per https://cloud.google.com/error-reporting/docs/setup/python
  • Set up the required Google IAM credentials - eg set the environment variable GOOGLE_APPLICATION_CREDENTIALS as the path to a service account JSON file, for an account that has the “Errors Writer” permission.
  1. Install the package:

    pip install dj_cloud_error
    
  2. Enable the provided exception handler by setting handler500 in your Django project’s root urls.py:

    # in myproject/urls.py
    import dj_cloud_error
    
    handler500 = dj_cloud_error.handler500
    

Note: handler500 is only used if DEBUG = False in django settings.

Settings

To disable error reporting (eg in your CI/CD environment), add this to your django settings:

# in myproject/settings/test.py
CLOUD_ERROR_REPORTING_DISABLED = True

To configure the name under which the errors appear in add this to your django settings:

CLOUD_ERROR_REPORTING_SERVICE_NAME = "myservice"  # defaults to "python"

Optional Extras

If django-ipware is installed it’s used to log the client IP address, it can be installed as follows:

pip install dj_cloud_error[ip]

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2019-10-01)

  • First release on PyPI.

Project details


Release history Release notifications

This version

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dj-cloud-error, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size dj_cloud_error-0.1.0-py3-none-any.whl (5.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size dj-cloud-error-0.1.0.tar.gz (11.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page