django-dropbox-storage
A Dropbox Storage for your Django apps
What
django-dropbox-storage allows Django apps to use Dropbox as a storage backend for file uploading.
Installing
First things first:
$ pip install django-dropbox-storage
Then open the settings.py of your project and include it to your INSTALLED_APPS:
INSTALLED_APPS = (
...
'django_dropbox_storage',
...
)
If you want to use django_dropbox_storage as default storage for all file uploads, you need to adjust DEFAULT_FILE_STORAGE too:
DEFAULT_FILE_STORAGE = 'django_dropbox_storage.storage.DropboxStorage'
If you just want to use it on a single model field, you can simply import it:
from django_dropbox_storage.storage import DropboxStorage
DROPBOX_STORAGE = DropboxStorage()
photo = models.ImageField(upload_to='photos', storage=DROPBOX_STORAGE ...)
In order to let it work properly, you must set the next settings:
DROPBOX_ACCESS_TOKEN = 'xxx'
If you don't have DROPBOX_ACCESS_TOKEN you can create one after creating a Dropbox app at Dropbox for Developers.
If you have your Dropbox App key and App secret, you can set DROPBOX_CONSUMER_KEY and DROPBOX_CONSUMER_SECRET settings in settings.py, then run:
$ python manage.py get_dropbox_token [--settings=test_settings]
And follow up on screen instructions, finally set the DROPBOX_ACCESS_TOKEN_SECRET in your settings.py module.
You can also set default root folder setting the value of DROPBOX_ROOT_FOLDER:
DROPBOX_ROOT_FOLDER = '/Public'
By default it's set to '/' (root folder).
Tests
Tests are written following Django's best practices.
In order to run them, you need to set DROPBOX_ACCESS_TOKEN properly.
NOTE: if you're testing this package as stand-alone, you can set the access token in a local_settings.py module put in the root folder.
To launch the test suite:
$ python manage.py test [--settings=test_settings]
To check the unit tests coverage you can:
$ pip install coverage
$ coverage run manage.py test [--settings=test_settings]
$ coverage report -m
Contributing
When contributing, please follow these steps:
- Clone the repo and make your changes.
- Make sure your code has test cases written against it.
- Make sure all the tests pass.
- Lint your code with Flake8.
- Add your name to the list of contributers.
- Submit a Pull Request.
Authors
- Emanuele Bertoldi
This project is based on previous work by:
- Andres Torres django-dropbox
- Maximiliano Cecilia django-dropbox
- Josh Schneier django-storages
- Danielle Madeley django-storages
Kudos and many thanks to all of them!
License
Copyright (c) 2018 Emanuele Bertoldi
Release files for django-dropbox-storage-fork 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-dropbox-storage-fork-0.4.2.tar.gz | 8.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_dropbox_storage_fork-0.4.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.1 kB
Release files / django-dropbox-storage-fork-0.4.2.tar.gz
| Download URL | django-dropbox-storage-fork-0.4.2.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee7f143342be846cfc26a6c9dc09fde9af09467055124cb8251fe47bcd4bd7aa
|
|
BLAKE2b-256 checksum How to use checksums |
3a5fcbd3483e8ecd56db4be92542d5525bde1de8f90ff74a44e44d8a3b2b4a0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5
|
Release files / django_dropbox_storage_fork-0.4.2-py3-none-any.whl
| Download URL | django_dropbox_storage_fork-0.4.2-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d18091e6f5866d8fcc08f7b89a2d853b5cb8939052b9543a0bbd6854ff37783
|
|
BLAKE2b-256 checksum How to use checksums |
8fb027f52b94bbb437f63999e93d8d2ee35ff47510ab7f31bc20658479ee0f90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5
|