Skip to content

Lightrun for Flask

In order to run a Flask web app with the Lightrun agent please follow these steps:

  • In the application folder, install the python agent by running python -m pip install lightrun
  • Add the following code to your application's main or (the import shouldn't be added to a specific routed method, but to the main file code instead):
    import lightrun
    lightrun.enable(com_lightrun_server='<COMPANY-NAME>', com_lightrun_secret='<COMAPNY-SECRET>')
except ImportError as e:
    print("Error importing Lightrun: ", e)

# Example route
def hello_world():
    return "<p>Hello world!</p>"

Last update: September 27, 2021