Django Github Storage is a Django package that facilitates integration with Github by implementing Django Storage API. With several lines of configuration, you can start using Github for yourfiles. It uses PyGithub package under the hood.
It is simple to contribute to implement:
The package requires Python 3.4+ and Django 3+.
To install the package, just run:
$ pip install django-git-storages
You need to add Github credentials to settings.py
:
GIT_STORAGE = {
'GIT_ACCESS_TOKEN': 'your_github_access_token',
'GIT_REPO': 'username/repo',
}
Instead of putting credentials in settings.py
, you can provide them as GITHUB_ACCESS_TOKEN
,
and GITHUB_REPO
environment variables.
Fianlly add to settings.py
:
DEFAULT_FILE_STORAGE = 'git_storage.storage.GithubStorage'