thevsg
Last Updated: February 25, 2016
·
539
· miguelmramos
Avatar small

Django NewRelic

Today just playing with NewRelic. What i nice service. I just read it that we can have reports about our web application. So how to integrate that to Django? Read it most of the python documentation on relic site and after that let's play it with my local application. So, i use nginx and WSGI. Make it playing with django i never thought it was so easy.

First install newrelic

pip install newrelic

After let's make our ini just as they say on setup (follow the steps). After that make some changes on wsgi.py.

import newrelic.agent

newrelic.agent.initialize('/home/username/path/to/myproject/newrelic.ini')

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")

from django.core.wsgi import get_wsgi_application

application = get_wsgi_application()
application = newrelic.agent.wsgi_application()(application)

And that's it. Make some requests on your browser and after some minutes dashboard on newrelic show us a tremendous information

Say Thanks
Respond