This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path, include
|
from django.urls import path, include, re_path
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.conf.urls.static import static
|
from django.conf.urls.static import static
|
||||||
|
from .media_views import MediaFileView
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
@@ -11,11 +12,11 @@ urlpatterns = [
|
|||||||
path('users/', include('users.urls')), # User management app
|
path('users/', include('users.urls')), # User management app
|
||||||
path('links/', include('links.urls')), # Link management app
|
path('links/', include('links.urls')), # Link management app
|
||||||
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||||
|
|
||||||
|
# Кастомный view для обслуживания медиа файлов в production
|
||||||
|
re_path(r'^storage/(?P<file_path>.*)$', MediaFileView.as_view(), name='media'),
|
||||||
]
|
]
|
||||||
|
|
||||||
if settings.DEBUG:
|
|
||||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
|
||||||
|
|
||||||
|
|
||||||
# Summary of API Endpoints:
|
# Summary of API Endpoints:
|
||||||
# POST /api/auth/register/ - Register new user
|
# POST /api/auth/register/ - Register new user
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ const nextConfig = {
|
|||||||
port: '8000', // where Django serves media
|
port: '8000', // where Django serves media
|
||||||
pathname: '/storage/**', // storage/avatars, images/link_groups, etc.
|
pathname: '/storage/**', // storage/avatars, images/link_groups, etc.
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
protocol: 'https',
|
||||||
|
hostname: 'links.shareon.kr',
|
||||||
|
pathname: '/storage/**', // storage/avatars, images/link_groups, etc.
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user