Skip to content

Commit f9aacc3

Browse files
committed
fix: static URL s3 설정 변경
Signed-off-by: SaJH <wogur981208@gmail.com>
1 parent 5ba1a08 commit f9aacc3

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

app/core/settings.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,18 @@
269269
# Static files (CSS, JavaScript, Images)
270270
# https://docs.djangoproject.com/en/5.2/howto/static-files/
271271
STATIC_ROOT = BASE_DIR / "static"
272-
STATIC_URL = "static/"
273272

274273
DEFAULT_STORAGE_BACKEND = env("DJANGO_DEFAULT_STORAGE_BACKEND", default="storages.backends.s3.S3Storage")
275274
STATIC_STORAGE_BACKEND = env("DJANGO_STATIC_STORAGE_BACKEND", default="storages.backends.s3.S3Storage")
276275

277276
STORAGE_BUCKET_NAME = f"pyconkr-backend-{API_STAGE}"
277+
278+
STATIC_URL = (
279+
f"https://{STORAGE_BUCKET_NAME}.s3.amazonaws.com/"
280+
if STATIC_STORAGE_BACKEND == "storages.backends.s3.S3Storage"
281+
else "static/"
282+
)
283+
278284
STORAGE_OPTIONS = (
279285
{
280286
"bucket_name": STORAGE_BUCKET_NAME,

app/core/urls.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import core.health_check
1919
from django.conf import settings
20-
from django.conf.urls.static import static
2120
from django.contrib import admin
2221
from django.urls import include, path, re_path, resolvers
2322
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
@@ -33,7 +32,7 @@
3332
path("admin/", admin.site.urls),
3433
# V1 API
3534
re_path("^v1/", include((v1_apis, "v1"), namespace="v1")),
36-
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
35+
]
3736

3837
if settings.DEBUG:
3938
urlpatterns += [

0 commit comments

Comments
 (0)