summaryrefslogtreecommitdiff
path: root/yaksh/storage_backends.py
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2021-03-24 10:13:27 +0530
committerGitHub2021-03-24 10:13:27 +0530
commitf44cbc461f4c23c08d655749ccb525d99f2e7dbc (patch)
tree7a7f0b29a23685734d45265773db916bedad380f /yaksh/storage_backends.py
parent6fda19daaa06482b8eb52eeb62f9b0a15d0a3da6 (diff)
parent8192bf7a17070f2202d9282a4873795127a17447 (diff)
downloadonline_test-f44cbc461f4c23c08d655749ccb525d99f2e7dbc.tar.gz
online_test-f44cbc461f4c23c08d655749ccb525d99f2e7dbc.tar.bz2
online_test-f44cbc461f4c23c08d655749ccb525d99f2e7dbc.zip
Merge pull request #823 from adityacp/s3_file_upload
Add AWS support for file upload
Diffstat (limited to 'yaksh/storage_backends.py')
-rw-r--r--yaksh/storage_backends.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/yaksh/storage_backends.py b/yaksh/storage_backends.py
new file mode 100644
index 0000000..206e456
--- /dev/null
+++ b/yaksh/storage_backends.py
@@ -0,0 +1,18 @@
+from django.conf import settings
+from storages.backends.s3boto3 import S3Boto3Storage
+
+
+class StaticStorage(S3Boto3Storage):
+ if settings.USE_AWS:
+ location = settings.AWS_STATIC_LOCATION
+ else:
+ pass
+
+
+class PublicMediaStorage(S3Boto3Storage):
+ if settings.USE_AWS:
+ location = settings.AWS_PUBLIC_MEDIA_LOCATION
+ file_overwrite = True
+ default_acl = 'public-read'
+ else:
+ pass