Skip to content

Commit 4bccf09

Browse files
Merge pull request #1 from pcampos119104/dev
s3
2 parents 427aa11 + 29c80ab commit 4bccf09

5 files changed

Lines changed: 304 additions & 183 deletions

File tree

.env.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ DB_HOST=postgres
88
DB_PORT=5432
99
CSRF_TRUSTED_ORIGINS=http://localhost
1010
SENTRY_DSN=
11+
PORT=
12+
AWS_STORAGE_BUCKET_NAME=
13+
AWS_S3_ENDPOINT_URL=
14+
AWS_ACCESS_KEY_ID=
15+
AWS_SECRET_ACCESS_KEY=

cdc/settings.py

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
'django.contrib.contenttypes',
5858
'django.contrib.sessions',
5959
'django.contrib.messages',
60+
'django.contrib.postgres',
6061
'django.contrib.staticfiles',
6162
'django_extensions',
6263
'django_browser_reload',
@@ -174,17 +175,38 @@
174175
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
175176

176177
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
177-
STORAGES = {
178-
'default': {
179-
'BACKEND': 'django.core.files.storage.FileSystemStorage',
180-
'OPTIONS': {
181-
'location': MEDIA_ROOT,
178+
if DEBUG:
179+
STORAGES = {
180+
'default': {
181+
'BACKEND': 'django.core.files.storage.FileSystemStorage',
182182
},
183-
},
184-
'staticfiles': {
185-
'BACKEND': 'whitenoise.storage.CompressedStaticFilesStorage',
186-
},
187-
}
183+
'staticfiles': {
184+
'BACKEND': 'whitenoise.storage.CompressedStaticFilesStorage',
185+
},
186+
}
187+
else:
188+
STORAGES = {
189+
'default': {
190+
'BACKEND': 'storages.backends.s3.S3Storage',
191+
'OPTIONS': {
192+
'bucket_name': env.str('AWS_STORAGE_BUCKET_NAME'),
193+
'endpoint_url': env.str('AWS_S3_ENDPOINT_URL'), # Interno Docker
194+
'querystring_auth': True,
195+
'querystring_expire': 900,
196+
'default_acl': None,
197+
'region_name': 'us-east-1',
198+
'signature_version': 's3v4',
199+
'addressing_style': 'path',
200+
'url_protocol': 'https',
201+
},
202+
},
203+
'staticfiles': {
204+
'BACKEND': 'whitenoise.storage.CompressedStaticFilesStorage',
205+
},
206+
}
207+
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
208+
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
209+
188210

189211
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10_000
190212

cdc/static/css/output.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,9 @@
10281028
.p-2\.5 {
10291029
padding: calc(var(--spacing) * 2.5);
10301030
}
1031+
.p-3 {
1032+
padding: calc(var(--spacing) * 3);
1033+
}
10311034
.p-4 {
10321035
padding: calc(var(--spacing) * 4);
10331036
}

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies = [
1818
"sentry-sdk[django]>=2.32.0",
1919
"xonsh>=0.19.9",
2020
"wagtail>=7.2",
21+
"django-storages[s3]>=1.14.6",
2122
]
2223

2324
[dependency-groups]

0 commit comments

Comments
 (0)