Go to file
2018-06-04 10:07:42 -04:00
dbfilestorage Python3 and Django 1.11 upgrade (#40) 2018-03-01 15:32:02 -05:00
docs Version 1.0.1 2018-06-04 10:06:11 -04:00
tests Python3 and Django 1.11 upgrade (#40) 2018-03-01 15:32:02 -05:00
.coveragerc separate filename and filehash (#21) 2017-01-20 14:38:41 -05:00
.gitignore add more tests (#14) 2016-12-09 10:07:16 -05:00
.gitlab-ci.yml Initial commit after moving from Gitlab 2016-12-07 22:50:48 -05:00
CHANGELOG move changelog to file 2018-06-04 10:07:42 -04:00
circle.yml Python3 and Django 1.11 upgrade (#40) 2018-03-01 15:32:02 -05:00
CONTRIBUTORS.md Version 1.0.1 2018-06-04 10:06:11 -04:00
LICENSE.txt remove copyright from license 2018-05-02 14:18:23 -04:00
manage.py Initial commit after moving from Gitlab 2016-12-07 22:50:48 -05:00
README.md move changelog to file 2018-06-04 10:07:42 -04:00
requirements-dev.txt Python3 and Django 1.11 upgrade (#40) 2018-03-01 15:32:02 -05:00
requirements.txt Python3 and Django 1.11 upgrade (#40) 2018-03-01 15:32:02 -05:00
setup.cfg More tests (#9) 2016-12-08 15:30:39 -05:00
setup.py Version 1.0.1 2018-06-04 10:06:11 -04:00
tox.ini Python3 and Django 1.11 upgrade (#40) 2018-03-01 15:32:02 -05:00

Django-dbfilestorage

CircleCI codecov

Custom file storage for Django that stores file data and content type in the database. Easy to use for testing remote storages when you're in a transition stage between Local and something like Amazon S3.

Intended to be used in tests, never in production.

TESTING

I use Pyenv and Tox to support Python2.7.13 and Python3.6.3

pip install -r requirements-dev.txt
pyenv install 2.7.13 3.5.4 3.6.3
tox

Or you can run individually with your shell python using python setup.py test

INSTALLATION

pip install django-dbfilestorage

Then in your project's settings.py file, add 'dbfilestorage' to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'dbfilestorage'
)

Next, if you want to set this globally, set the setting:

DEFAULT_FILE_STORAGE='dbfilestorage.storage.DBFileStorage'

Or you can set it individually on a field: Django Docs

from dbfilestorage.storage import DBFileStorage

class SomeClass(models.Model):
    file = models.FileField(upload_to=u'anywhere',
        storage=DBFileStorage())

TODO

  • Test that this works on a fake model, not just the storage file.
  • Different django versions.

Signing Key

You can find my signing key at TyrelSouza.com

I will sign everything with 0x769A1BC78A2DDEE2