Reordered and cleaned up urls.

This commit is contained in:
SergeantPanda 2025-03-04 09:28:07 -06:00
parent aa74d5a9fd
commit 15c277e0d4

View file

@ -27,7 +27,7 @@ urlpatterns = [
path('api', RedirectView.as_view(url='/api/', permanent=True)),
# Admin
path('admin', RedirectView.as_view(url='/admin/', permanent=True)), # This fixes the issue
path('admin', RedirectView.as_view(url='/admin/', permanent=True)),
path('admin/', admin.site.urls),
# Outputs
@ -35,9 +35,13 @@ urlpatterns = [
path('output/', include(('apps.output.urls', 'output'), namespace='output')),
# HDHR
path('hdhr', RedirectView.as_view(url='/hdhr/', permanent=True)), # This fixes the issue
path('hdhr', RedirectView.as_view(url='/hdhr/', permanent=True)),
path('hdhr/', include(('apps.hdhr.urls', 'hdhr'), namespace='hdhr')),
# Add proxy apps - Move these before the catch-all
path('proxy/', include('apps.proxy.urls')),
path('proxy', RedirectView.as_view(url='/proxy/', permanent=True)),
# Swagger UI
path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
@ -47,12 +51,9 @@ urlpatterns = [
# Optionally, serve the raw Swagger JSON
path('swagger.json', schema_view.without_ui(cache_timeout=0), name='schema-json'),
# Catch-all route to serve React's index.html for non-API, non-admin paths
# Catch-all routes should always be last
path('', TemplateView.as_view(template_name='index.html')), # React entry point
# Add proxy apps
path('proxy/', include('apps.proxy.urls')),
path('proxy', RedirectView.as_view(url='/proxy/', permanent=True)),
path('<path:unused_path>', TemplateView.as_view(template_name='index.html')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
@ -60,5 +61,3 @@ urlpatterns = [
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += [path('<path:unused_path>', TemplateView.as_view(template_name='index.html'))]