Lightrun for Gunicorn¶
To run a Gunicorn WSGI HTTP server with the Lightrun agent, follow these steps:
- In your application folder, install the Python agent by running
python -m pip install lightrun
. - Add the following code to your application's
.py
file.try: import lightrun lightrun.enable(com_lightrun_server=<company_url>, company_key=<company_key>) except ImportError as e: print("Error importing Lightrun: ", e)
- Run your Gunicorn application as normal.
Important
The Lightrun import statement must be outside your function but in the same file.
Note
If you are running Gunicorn inside a framework, add the Lightrun import statement to your wsgi.py
file and run the file with Gunicorn.
Last update: October 10, 2024