38086-vm/config/urls.py
2026-02-09 12:28:28 +00:00

30 lines
1.2 KiB
Python

from django.contrib import admin
from django.urls import include, path
from django.conf import settings
from django.conf.urls.static import static
from django.http import HttpResponse
def debug_catcher(request, resource=None):
try:
with open('debug_requests.txt', 'a') as f:
f.write(f"Caught 404 candidate: {request.path}\n")
except Exception:
pass
return HttpResponse(f"<h1>Debug 404 Catcher</h1><p>You requested: <strong>{request.path}</strong></p><p>This URL was not matched by any standard pattern.</p>")
urlpatterns = [
path("admin/", admin.site.urls),
path("accounts/", include("django.contrib.auth.urls")),
path("i18n/", include("django.conf.urls.i18n")),
path("", include("core.urls")),
path("accounting/", include("accounting.urls")),
path("hr/", include("hr.urls")),
]
if settings.DEBUG:
urlpatterns += static("/assets/", document_root=settings.BASE_DIR / "assets")
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# Append catch-all
urlpatterns.append(path('<path:resource>', debug_catcher))