mirror of
https://github.com/wahyd4/links.git
synced 2026-08-09 05:06:16 +10:00
36 lines
1.4 KiB
Python
36 lines
1.4 KiB
Python
from django.contrib import admin
|
|
from django.urls import path, include
|
|
from django.conf import settings
|
|
from django.conf.urls.static import static
|
|
from django.views.static import serve
|
|
from links.views import LinkDetailView, LinkUpdateView, CustomLinkView
|
|
from django.urls import path, include, re_path
|
|
from django.conf.urls.i18n import i18n_patterns
|
|
|
|
urlpatterns = [
|
|
path('admin/', admin.site.urls),
|
|
# Add API URLs before locale URLs
|
|
path('api/', include('links.api_urls')), # New line for API routes
|
|
# Media files
|
|
path('media/<path:path>', serve, {
|
|
'document_root': settings.MEDIA_ROOT,
|
|
}),
|
|
# Music files
|
|
path('music/<path:path>', serve, {
|
|
'document_root': settings.MUSIC_ROOT,
|
|
}),
|
|
path('i18n/', include('django.conf.urls.i18n')),
|
|
path('search/', include('links.search_urls')),
|
|
path('link/<int:pk>/', LinkDetailView.as_view(), name='link_detail'),
|
|
path('link/<int:pk>/edit/', LinkUpdateView.as_view(), name='link_update'),
|
|
path('custom/<slug:alias>/', CustomLinkView.as_view(), name='custom_link'),
|
|
path('custom/<slug:alias>/edit/', LinkUpdateView.as_view(), name='custom_link_update'),
|
|
|
|
# Include main app URLs with locale
|
|
path('', include('links.urls')),
|
|
]
|
|
|
|
if settings.DEBUG:
|
|
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|