Skip to content

Commit

Permalink
Add support for backblaze B2
Browse files Browse the repository at this point in the history
  • Loading branch information
techlover1 committed Dec 30, 2019
1 parent 10c387d commit 33d77d6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ In `olly/settings.py` fill in the following fields:
- `SECRET_KEY` - This value is used for django's cryptographic signing functions. You can easily generate this by running `from django.core.management.utils import get_random_secret_key` followed by `get_random_secret_key()` in a django shell (`python manage.py shell`)
- `ALLOWED_HOSTS` - It is strongly recommended to set this to the domain name of your site to prevent HTTP host header attacks
- `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_S3_ENDPOINT_URL` - Authentication information for AWS S3 compatable object storage. Note: this is not required, however we do not currently have documentation on how to setup with local storage
- `AWS_STORAGE_BUCKET_NAME` - This is simply the name you wish to use for your S3 compatable bucket
- Uncomment the section for either S3 compatible storage or Backblaze B2 storage and fill in the required information
- `EMAIL_HOST` - The hostname of your email server (for example `smtp.gmail.com`)
- `EMAIL_HOST_USER` and `EMAIL_HOST_PASSWORD` - the login information for your email account
- `FROM_EMAIL` - The name and email address that will be shown in the "From" field in emails
Expand Down
30 changes: 23 additions & 7 deletions olly/settings.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,29 @@ DATABASES = {
# Media files
MEDIA_ROOT = os.path.join(BASE_DIR, 'olly/media')

AWS_ACCESS_KEY_ID = ''
AWS_SECRET_ACCESS_KEY = ''
AWS_S3_ENDPOINT_URL = ''
AWS_STORAGE_BUCKET_NAME = ''
AWS_LOCATION = 'media'
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
MEDIA_URL = "%s/%s/" % (AWS_S3_ENDPOINT_URL, AWS_STORAGE_BUCKET_NAME)
#### Uncomment this section for S3 compatible storage ####
#AWS_ACCESS_KEY_ID = 'Key ID'
#AWS_SECRET_ACCESS_KEY = 'Secret key'
#AWS_S3_ENDPOINT_URL = 'S3 compatible endpoint URL'
#AWS_STORAGE_BUCKET_NAME = 'Bucket Name'
#AWS_LOCATION = 'media'
#DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
#MEDIA_URL = "%s/%s/" % (AWS_S3_ENDPOINT_URL, AWS_STORAGE_BUCKET_NAME)
#### End section #####

#### Uncomment this section for backblaze B2 storage ####
#LIBCLOUD_PROVIDERS = {
# 'backblaze': {
# 'type': 'libcloud.storage.types.Provider.BACKBLAZE_B2',
# 'user': 'Key ID',
# 'key': 'Secret key',
# 'bucket': 'Bucket Name',
# }
#}
#DEFAULT_LIBCLOUD_PROVIDER = 'backblaze'
#DEFAULT_FILE_STORAGE = 'storages.backends.apache_libcloud.LibCloudStorage'
#MEDIA_URL = 'https://f000.backblazeb2.com/file/%s/' % (LIBCLOUD_PROVIDERS['backblaze']['bucket'])
#### End section ####

# Email stuff
EMAIL_USE_TLS = True
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ django-countries>=5.3
psycopg2-binary>=2.7.4
pytz>=2018.4
boto3>=1.7.42
django-storages>=1.6.6
django-storages>=1.6.6
apache-libcloud>=2.7.0

0 comments on commit 33d77d6

Please sign in to comment.