# Database storage for Django
This package implements the Django Storage API to store any file in any database supported by Django. In many cases it is a bad idea to store files in database because performance can degrade rapidly.
* Python 2.7, 3+
* Django 1.7+
1. Install using pip:
pip install django-dbase-storage
2. Add to INSTALLED_APPS:
INSTALLED_APPS = (
3. Run migrations to create table to store files
python manage.py migrate dbfile
Now you can set default storage for the whole project in settings:
DEFAULT_FILE_STORAGE = 'dbfile.storage.DatabaseStorage'
or specify it for certain fields of your models:
file = FileField(storage=DatabaseStorage())
DatabaseStorage fails to store file if debug-toolbar is enabled. Debug-toolbar converts binary to UTF-8 somewhere
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.