Python agent quick start

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.

Installation 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.

  1. Make sure you have your license key.

  2. Install the newrelic Python package using pip by running:

    pip install newrelic
  3. Generate the agent configuration file by running the command:

    newrelic-admin generate-config YOUR_LICENSE_KEY newrelic.ini
  4. Validate the agent configuration and that our data collector service is contactable:

    newrelic-admin validate-config newrelic.ini
  5. 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')
  6. Start or restart your Python web application or WSGI server.

For more help

Additional documentation resources include:

Join the discussion about Python in the New Relic Online Technical Community! The Technical Community is a public platform to discuss and troubleshoot your New Relic toolset.

If you need additional help, get support at support.newrelic.com.