Go to file
2017-01-27 15:53:23 -05:00
dbfilestorage Remove filehash, set pk to name (#33) 2017-01-27 15:52:02 -05:00
docs Bump versin to 0.6.0 2017-01-27 15:53:23 -05:00
tests Remove filehash, set pk to name (#33) 2017-01-27 15:52: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
circle.yml fix circle? 2016-12-08 14:25:17 -05:00
LICENSE.txt Initial commit after moving from Gitlab 2016-12-07 22:50:48 -05:00
manage.py Initial commit after moving from Gitlab 2016-12-07 22:50:48 -05:00
README.md Bump versin to 0.6.0 2017-01-27 15:53:23 -05:00
requirements.txt Setup for Coverage and Codcov.io (#6) 2016-12-08 14:54:53 -05:00
setup.cfg More tests (#9) 2016-12-08 15:30:39 -05:00
setup.py Bump versin to 0.6.0 2017-01-27 15:53:23 -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.

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 and different python versions.

Signing Key

You can find my signing key at TyrelSouza.com

I will sign everything with 0x769A1BC78A2DDEE2

CHANGELOG

  • 2017-01-27 [Tyrel Souza] Get rid of filehash
  • 2017-01-26 [Tyrel Souza] Check filehash and filename, not just hash when checking if it needs to be saved.
  • 2017-01-25 [Tyrel Souza] Keeping Filename on upload.
  • 2017-01-23 [Tyrel Souza] Add Modified Time to storage support
  • 2017-01-23 [Tyrel Souza] Everything should return a "filename" even if it's generated. Make the filename be the hash + ext. (fall back to .txt)
  • 2017-01-20 [Tyrel Souza] Make path return None if no file
  • 2017-01-20 [Tyrel Souza] Make path return filename
  • 2017-01-20 [Tyrel Souza] Add another migration, and redo all the initial migrations.
  • 2017-01-20 [Tyrel Souza] Make sure migrations is actually there.
  • 2017-01-20 [Tyrel Souza] Split filename and filehash.
  • 2016-12-09 [Tyrel Souza] Add signing key to readme.
  • 2016-12-09 [Tyrel Souza] Update Tests, add some cleanup.
  • 2016-12-08 [Tyrel Souza] Add more documentation.
  • 2016-12-07 [Tyrel Souza] Update Readme, move to github, gitlab wasn't functioning properly.
  • 2016-12-07 [Tyrel Souza] Initial commits and basic project setup