I am using Django and trying out New Relic. Is it possible to monitor the Django development server? I can only seem to find help on setting up New Relic with production servers.
'How to' for future reference:
(I used Django1.4)
Follow this: https://newrelic.com/docs/python/python-agent-installation
As the last step of that guide (Integration with your Application) change your wsgi.py
file to the following:
import newrelic.agent
newrelic.agent.initialize('/home/username/path/to/myproject/newrelic-1.9.0.21/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)
Now sign in to your account on the New Relic platform, make a few requests to your development server and see the changes on the the platform. Grats, you made it!
As of Django 1.4, the startproject command creates a wsgi file that the runserver
command will use.
If you have an older Django project that does not have a wsgi file, you can create one as described in the Django docs, and set WSGI_APPLICATION
in your settings.py
file.
You should be able to set up new relic by modifying this wsgi file as described by the New Relic docs for Python agent integration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With