Package: django-db-sanitizer
Authors:Resulto Developpement Web Inc.Version:0.1.0This project’s main goal is to provide a way to anonymize the data of
specific database fields by explicitly configuring said fields with specific
anonymization strategies.The anonymization process provides a “Production-like” copy of your database
without sensitive information which can then be used in a development
environment.Requirementsdjango-db-sanitizer works and has been tested with Python 2.7 and 3.5.
It requires Django 1.8+ and fake-factory 0.5.7+.InstallationInstall the librarypip install django-db-sanitizerAdd the library to your INSTALLED_APPS in your Django SettingsINSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django_db_sanitizer',
)Important NotesDO NOT RUN IN YOUR PRODUCTION ENVIRONMENT!In its current state, django-db-sanitizer will run its sanitizing command and
operations on your default database.While there are plans to investigate the possibility of allowing the sanitizing
process to run on alternate databases, this is not yet implemented.It is recommended to run django-db-sanitizer on a copy of your application and
database running on your local machine.Please read theUsagesection below for more information.UsageCreating db_sanitizer.pyConfiguration of django-db-sanitizer works similarly to the configuration of
the Django admin site.To use django-db-sanitizer for one of your Django apps, create adb_sanitizer.pyfile into said Django app just as you would create anadmin.pyfile for the Django admin site.Model and field declarationsInside thedb_sanitizer.pyfile of your app, you must explicitly register
which fields of which models will be sanitized using an explicitly declared
Sanitizer class.In the following example, thenotestext field of theProfileclass
will be sanitized using theLoremIpsumSanitizersanitizing strategy,
filling the contents of the field withLorem Ipsumtext.from django_db_sanitizer import sanitizer_registry, LoremIpsumSanitizer

from my_app.models import Profile

sanitizer_registry.register(Profile, ["notes"], LoremIpsumSanitizer)Customizing the sanitizing processdjango-db-sanitizer is meant to be easy to extend. It is easily possible to
override or extend classes from django-db-sanitizer to:Filter querysets on which the sanitizing process is appliedModify existing Sanitizer classes to alter their behaviorAdd your own new Sanitizer classesAdd your own Updater classes to control how values are saved to the databaseAnd more…Please refer to thetest_appin django-db-sanitizer’stest_projectwithin the repository for a number of examples on how to achieve this.Running the sanitizing processCurrently, the only way to run the sanitizing process is to use the included
Django command, like so:python manage.py sanitize_my_databaseThis command does not use or require any arguments for the time being.Please note that the sanitizing process is irreversible. It is recommended to
run django-db-sanitizer on a copy of your application and database running on
your local machine.LicenseThis software is licensed under theNew BSD License. See theLICENSEfile
in the repository for the full license text.