update pour les medias

This commit is contained in:
Guamss 2025-12-18 18:13:52 +01:00
parent dac999196c
commit cad5114de8
2 changed files with 8 additions and 3 deletions

View File

@ -44,7 +44,7 @@ CORS_ALLOWED_ORIGINS = [
"http://localhost:5173", "http://localhost:5173",
'http://127.0.0.1:5173', 'http://127.0.0.1:5173',
'http://192.168.1.35:5173', 'http://192.168.1.35:5173',
'https://mybooklist.guams.fr' 'https://mybooklist.guams.fr',
'https://mybooklist-api.guams.fr' 'https://mybooklist-api.guams.fr'
] ]

View File

@ -16,7 +16,8 @@ Including another URLconf
""" """
from django.conf.urls.static import static from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path, re_path
from django.views.static import serve
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView
from api import settings from api import settings
@ -33,4 +34,8 @@ urlpatterns = [
path('api/users/<int:user_id>', views.find_user_by_id, name='user-detail'), path('api/users/<int:user_id>', views.find_user_by_id, name='user-detail'),
] ]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += [
re_path(r'^media/(?P<path>.*)$', serve, {
'document_root': settings.MEDIA_ROOT,
}),
]