If you are using one of our supported WSGI frameworks, getting New Relic set up with your Python web application is quick and easy using the following steps.
For a standard install, follow these steps to get your Python agent up and running.
Note: As part of the installation process, change the default application name to a meaningful name.
Make sure you have your license key.
Install the newrelic Python package using pip by running:
pip install newrelic
Generate the agent configuration file by running the command:
newrelic-admin generate-config YOUR_LICENSE_KEY newrelic.ini
Validate the agent configuration and that our data collector service is contactable:
newrelic-admin validate-config newrelic.ini
If you control how your web application or WSGI server is started, run the following:
NEW_RELIC_CONFIG_FILE=newrelic.ini newrelic-admin run-program YOUR_COMMAND_OPTIONS
Alternatively, if you cannot modify how your web application or WSGI server is started, modify the WSGI script file/module for your web application and insert this at the start of that file:
import newrelic.agent newrelic.agent.initialize('newrelic.ini')
Start or restart your Python web application or WSGI server.
For more help
Additional documentation resources include:
- New Relic for Python (an overview and system requirements for the Python agent)
- Python agent installation (a detailed walkthrough of the Python installation process)
- Python agent integration (integrating the Python agent into your application)
- Python hosting mechanisms (a list of additional documentation by hosting mechanism)
- Python hosting services (a list of additional documentation by hosting service)