Install the Python microagent¶ Install the Python microagent on your system using one of the following methods: If you control the way your web application or WSGI server starts, use the command-line launcher to install the microagent and launch your application. Install the microagent in your application by including the Sqreen microagent code. Install the microagent on Alpine Linux. Install the microagent on a Heroku application. Install the microagent for AWS Lambda Python functions. Install with CLI launcher¶ Review Python microagent compatibility to confirm that the Sqreen Microagent for Python is compatible with your Python application. Sign up to create your Sqreen account. Fetch your organization token. From the Sqreen Dashboard, access Account Settings > Environments & Tokens. Your token begins with env_org_. Take note of the token. From Terminal, install the microagent using pip. (Requires pip 8.1.0 or later: pip install -U pip). pip install sqreen In your application's root directory, use the following command to set up the Sqreen token and application name: # Replace the values for app_name and token with your own cat > sqreen.ini <<EOF [sqreen] app_name: YOUR_APPLICATION_NAME token: SQREEN_TOKEN EOF From Terminal, use the CLI launcher to start your application with the microagent. # Replace the application module name with yours sqreen-start gunicorn YOUR_APP_MODULE.wsgi The Sqreen Microagent for Python is also available in the PyPI repository. Install by including code¶ Follow steps 1 - 3 above. Add two lines of code to your application's wsgi.py or app.py file in the root directory. Before all other import lines, add: import sqreen sqreen.start() Install on Alpine Linux¶ Follow steps 1 - 3 above. Install the following runtime dependencies: apk add libgcc libstdc++ Install the Sqreen microagent using pip. (Requires pip 8.1.0 or later: pip install -U pip). pip install --extra-index-url https://download.sqreen.com/python/alpine sqreen If you use a requirements.txt file to install your dependencies, add the following: --extra-index-url https://download.sqreen.com/python/alpine sqreen Install in multiple environments¶ Typically, you install the Sqreen microagent in your production environment, but you can install it in multiple environments. Use a unique name describing the application and different token for each environment such as production, staging, and development. From the Sqreen Dashboard, navigate to Account Settings > Environments & Tokens to fetch a token associated to an existing environment or add a new one. When creating a new environment, Sqreen automatically creates a new token and associates it with it. Take note of the new token. Set up your application name and SQREEN_TOKEN in the Sqreen microagent configuration file. # Replace the the values for app_name and token with your own cat > sqreen.ini <<EOF [sqreen] app_name: YOUR_APPLICATION_NAME token: SQREEN_TOKEN EOF Uninstall¶ To uninstall the Sqreen microagent, remove the module from your application.