This repository was archived by the owner on Mar 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Original file line number Diff line number Diff line change
1
+ from backend .storage_backends import PrivateMediaStorage
2
+
1
3
from django .db import models
2
4
3
5
# Create your models here.
4
6
5
7
6
8
class StatementFile (models .Model ):
7
- statement_file = models .FileField ()
9
+ statement_file = models .FileField (
10
+ storage = PrivateMediaStorage , upload_to = "banking"
11
+ )
8
12
month = models .DateField (null = False , blank = False )
9
13
10
14
def __str__ (self ):
Original file line number Diff line number Diff line change 1
1
from django .conf import settings
2
+ from django .core .files .storage import FileSystemStorage
2
3
from storages .backends .s3boto3 import S3Boto3Storage
3
4
4
5
5
6
class StaticStorage (S3Boto3Storage ):
6
7
location = settings .AWS_STATIC_LOCATION
7
8
8
9
9
- class PrivateMediaStorage (S3Boto3Storage ):
10
- location = settings .AWS_PRIVATE_MEDIA_LOCATION
11
- default_acl = "private"
12
- file_overwrite = False
13
- custom_domain = False
10
+ if settings .DEBUG :
11
+
12
+ class PrivateMediaStorage (FileSystemStorage ):
13
+ location = settings .AWS_PRIVATE_MEDIA_LOCATION
14
+
15
+
16
+ else :
17
+
18
+ class PrivateMediaStorage (S3Boto3Storage ):
19
+ location = settings .AWS_PRIVATE_MEDIA_LOCATION
20
+ default_acl = 'private'
21
+ file_overwrite = False
22
+ custom_domain = False
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ services:
92
92
- main
93
93
environment :
94
94
- CI_PIPELINE_TRIGGERED=True
95
- - SECRET_KEY=${SECRET_KEY}
95
+ - SECRET_KEY=secret-key-for-development
96
96
- DEBUG=True
97
97
- DJANGO_EMAIL_HOST=${DJANGO_EMAIL_HOST}
98
98
- DJANGO_EMAIL_PORT=${DJANGO_EMAIL_PORT}
You can’t perform that action at this time.
0 commit comments