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+
13from django .db import models
24
35# Create your models here.
46
57
68class StatementFile (models .Model ):
7- statement_file = models .FileField ()
9+ statement_file = models .FileField (
10+ storage = PrivateMediaStorage , upload_to = "banking"
11+ )
812 month = models .DateField (null = False , blank = False )
913
1014 def __str__ (self ):
Original file line number Diff line number Diff line change 11from django .conf import settings
2+ from django .core .files .storage import FileSystemStorage
23from storages .backends .s3boto3 import S3Boto3Storage
34
45
56class StaticStorage (S3Boto3Storage ):
67 location = settings .AWS_STATIC_LOCATION
78
89
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:
9292 - main
9393 environment :
9494 - CI_PIPELINE_TRIGGERED=True
95- - SECRET_KEY=${SECRET_KEY}
95+ - SECRET_KEY=secret-key-for-development
9696 - DEBUG=True
9797 - DJANGO_EMAIL_HOST=${DJANGO_EMAIL_HOST}
9898 - DJANGO_EMAIL_PORT=${DJANGO_EMAIL_PORT}
You can’t perform that action at this time.
0 commit comments