Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Unable to integrate django application running in elasticbeanstalk with new relic


#1

My configs:

new relic.conf:
packages:
python3:
newrelic: []

commands:
01_command:
command: newrelic-admin generate-config [REDACTED INFO] newrelic.ini

wsgi.py:
from sys import version_info
print('my python version '+str( version_info[0]))

import newrelic.agent
import os
newrelic.agent.initialize(os.path.join(os.path.dirname(file), “newrelic.ini”))

os.environ.setdefault(“DJANGO_SETTINGS_MODULE”, “clickpost.settings”)

from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise

application = get_wsgi_application()
application = DjangoWhiteNoise(application)

Each time i deploy code i get error ImportError: No module named ‘newrelic’

Please help me out. It’s been long time i am stuck here,

Thanks


#2

@deepanshu.kartikey Thanks for your post. Would you happen to be using a virtual environment? If so, is the Python agent installed in the same virtual environment as your Django app?

Also, on a side note, there are two primary ways to integrate the Python agent with a Django app .

  1. Using the newrelic-admin wrapper script command.
  2. Manually integrating (described here).

Are you using both methods?