Skip to content

Commit 93817ef

Browse files
committed
Added s3 media storages
1 parent 5cb829c commit 93817ef

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

custom_storages.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@
44

55
class StaticStorage(S3Boto3Storage):
66
location = settings.STATICFILES_LOCATION
7+
8+
9+
class MediaStorage(S3Boto3Storage):
10+
location = settings.MEDIAFILES_LOCATION

issue_tracker/settings.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,20 @@
152152

153153
# STATIC_ROOT = (os.path.join(BASE_DIR, 'staticfiles'))
154154

155-
MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage"
156-
157-
TAGGIT_CASE_INSENSITIVE = True
155+
MEDIAFILES_LOCATION = 'media'
156+
DEFAULT_FILE_STORAGE = 'custom_storages.MediaStorage'
158157

159158
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
160-
MEDIA_URL = '/media/'
159+
MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION)
161160

162161
CRISPY_TEMPLATE_PACK = 'bootstrap4'
163162

164163
STRIPE_PUBLISHABLE = os.getenv('STRIPE_PUBLISHABLE')
165164
STRIPE_SECRET = os.getenv('STRIPE_SECRET')
166165

166+
TAGGIT_CASE_INSENSITIVE = True
167+
168+
MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage"
167169
MESSAGE_TAGS = {
168170
messages.DEBUG: 'alert-info',
169171
messages.INFO: 'alert-info',

0 commit comments

Comments
 (0)