Python agent and FastCGI web server

The 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 the Python agent.

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 app.py, instead run:

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

For more on the install process, see Install the Python agent.

For more help

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