Install the Python microagent¶ Install the Python microagent on your system using one of three methods: If you control the way your web application or WSGI server starts, use the command-line (CLI) launcher to install the microagent and launch your application. Change your application to include the Sqreen microagent code. Install with Alpine Linux. 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 agent in your production environment, but you can create several applications by specifying the environment in the application name. # Replace the the values for app_name and token with your own cat > sqreen.ini <<EOF [sqreen] app_name: YOUR_APPLICATION_NAME (staging) token: SQREEN_TOKEN EOF Uninstall¶ To uninstall the Sqreen microagent, remove the module from your application.