Treblle for Django(Python)

Requirements

  • requests

Installation

You can install Treblle for django via PYPi. Simply run the following command:

$ pip install treblle

Don’t forget to load the required python modules in your settings.py like so:

INSTALLED_APPS = [
...
'treblle',
]
MIDDLEWARE_CLASSES = [
...
'treblle.middleware.TreblleMiddleware',
]

Getting started

Next, create a FREE account on Treblle to get an API key and Project ID. After you have those simply initialize Treblle in your settinsg.py file like so for django:

TREBLLE_INFO = {
'api_key': os.environ.get('TREBLLE_API_KEY'),
'project_id': os.environ.get('TREBLLE_PROJECT_ID')
}

That’s it. Your API requests and responses are now being sent to your Treblle project. Just by adding these lines of code you get features like: auto-documentation, real-time request/response monitoring, error tracking and so much more.

Need to hide additional fields?

If you want to expand the list of fields you want to hide, you can pass property names you want to hide by using the TREBLLE_HIDDEN_KEYS setting like in the example below.

TREBLLE_HIDDEN_KEYS = ["id", "email"]
TREBLLE_INFO = {
'api_key': os.environ.get('TREBLLE_API_KEY'),
'project_id': os.environ.get('TREBLLE_PROJECT_ID'),
'hidden_keys' : TREBLLE_HIDDEN_KEYS
}

Support

If you have problems of any kind feel free to reach out via https://treblle.com or email vedran@treblle.com and we’ll do our best to help you out.

More Integrations

PHP

JavaScript

Others