Python agent compatibility


The Python agent is compatible with the the most popular web frameworks, operating systems and WSGI servers. Below you can find more details about specific version compatibility or any particular configuration you need to do for a specific combination.

Refer to installation steps to install Sqreen in your Python applications.

Sqreen supports the most popular Python web frameworks...

... but If your web framework is not listed below, just give us a shout!

Operating systems

The Sqreen Python agent is supported on all operating systems, including Linux, Mac OS X, and Windows.

Python versions

The Sqreen Python agent is fully compatible with:

  • Python 2.7.x
  • Python 3.4.x
  • Python 3.5.x
  • Python 3.6.x

Django, Flask and Pyramid

Django

The Sqreen Python agent is fully compatible with all versions from Django 1.6.x to Django 1.10.x. It is not yet compatible with Django 1.10 in ASGI mode.

Flask

The Sqreen Python agent is fully compatible with:

  • Flask 0.10.x
  • Flask 0.11.x
  • Flask 0.12.x

Pyramid

The Python agent is fully compatible with:

  • Pyramid 1.6
  • Pyramid 1.7
  • Pyramid 1.8
  • Pyramid 1.9

Servers compatibility

WSGI servers The Python agent is fully compatible with all the most popular WSGI Servers:

uWSGI servers The Python agent is fully compatible with uWSGI servers. When using uWSGI, you need to include some options:

  • --enable-threads, by default uWSGI doesn't permit the creation of threads. The Python agent requires threads for performance reasons.
  • --single-interpreter, by default with uWSGI, every app is loaded in a new Python interpreter. The Python agent is only compatible when your application is loaded on the same Python VM.
  • --py-call-osafterfork, by default uWSGI doesn't execute cleanup code on threads after forking while its the default behavior. This option re-enable it.

Automatic User Context in Python

Sqreen automatically detects and protects user accounts when your application is based on Django framework. For other frameworks or specific authentication methods, refer to advanced User Context in Python, using Python SDK for user monitoring.

In order to monitor and protect your users, the Python agent hooks the Django authenticate function. This allows the Sqreen Python agent to work with any authentication backend.

Django user identifiers

The Sqreen Python agent automatically detect the user identifier information. The following argument values are considered as your users identifier:

  • username
  • email
  • user
  • mail
  • login
  • name
  • id
  • userid
  • user_id
  • identification

If you don't see any authentication attempt on your dashboard, please check that your code is actually calling the standard Django authenticate function and that at least one keyword argument match the list above.

Don't hesitate to contact us if you need any help.

Database compatibility (NoSQL/SQL injection protection)

Sqreen protects against SQL and NoSQL injections for the most common production databases:

  • MySQL
  • PostgreSQL
  • SQLite

Other database?

Please, contact us if you are using a different database. We will adjust our roadmap!

Templating engine compatibility (cross-site scripting protection)

The protection against cross-site scripting attacks (XSS) is available for the most widespread templating engines in Python:

  • Django templating engine
  • Jinja2 templating engine

Other templating engine?

Please, contact us if you are using a different templating engine. We will adjust our roadmap!

Sqreen and NewRelic Agents

The Sqreen and NewRelic Python agents work perfectly together. Please ensure that, if you use the CLI helpers, you put sqreen-start before newrelic-admin:

sqreen-start newrelic-admin gunicorn ...

And if you modify the WSGI file, please import Sqreen before NewRelic:

try:
  import sqreen
  sqreen.start()
except ImportError:
  pass

try:
  import newrelic.agent
  newrelic.agent.initialize('newrelic.ini')
except ImportError:
  pass

Sqreen usage for non-web applications

Sqreen detects non-web applications at launch time (application working without a web server). Sqreen will not be enabled for the following cases:

  • Tests launchers
  • iPython interpreters
  • Celery workers
  • RQ workers
  • Django and Flask interactive interpreter (manage.py shell).

If you want to disable Sqreen when launching an application, you can add the SQREEN_DISABLE=1 environment variable.