Skip to content

LegoStormtroopr/django-database-files

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-database-files

image

django-database-files is a storage system for Django that stores files in the database. It can act as a storage class anywhere that accepts the Django storage API.

WARNING: There are serious downsides to storing and serving static files from Django, but there are some valid use cases.

If your Django app is behind a caching reverse proxy and you need to scale your application servers, it may be simpler to store files in the database.

Likewise, when using systems like Heroku where no easy and persistent file system exists, storing files in the database can provide a quick way to add file management.

Requires:

  • Django 1.11 or above only
  • Python 3.5 or above only

Installation

$ pip install django-database-files-ny

Usage

In settings.py, add database_files to your INSTALLED_APPS and add this line:

DEFAULT_FILE_STORAGE = 'database_files.storage.DatabaseStorage'

In your urls.py add a path to the database files:

url(r'^db_static/', include("database_files.urls")),

All your FileField and ImageField files will now be stored in the database.

Test suite

$ tox

About

A storage system for Django that stores uploaded files in the database.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%