Python agent and FastCGI web server

The New Relic Python agent can be used with FastCGI in conjunction with flup. There are no known special requirements or restrictions, so you can follow the general integration procedures in Install New Relic for Python.

Admin script integration example

For FastCGI, the web application is always managed as an external process. If you have integrated the FastCGI/WSGI adapter for flup, as in:

#!/usr/bin/env python

import sys
from fcgi import WSGIServer

def application(environ, start_response):
    status = '200 OK'
    output = 'Hello World!'

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

ret = WSGIServer(application).run()

and if you are starting your FastCGI process as a Python script directly with Python as python, instead run:

NEW_RELIC_CONFIG_FILE=newrelic.ini newrelic-admin run-program python

For more on the install process, see Install New Relic for Python.

For more help

If you need more help, check out these support and learning resources: