[Answered ]-How to fix this django path without this prefix?

1👍

Probably the ulusalb.urls contains a path that contains simply <slug:slug>? This means that it will capture any slug (or string), including firma. What a slug does not capture is a slash, and therfore if you use a slash, it will continue looking for patterns and eventually fire 1/firma/.

What you can do is put firma/ first:

from django.contrib import admin
from django.urls import include, path

urlpatterns = [
    path('admin/', admin.site.urls),
    path('firma/', include('firma.urls')),
    path('', include('ulusalb.urls')),
]

It will thus first look for patterns in firma.urls to match, and only if that fails, fallback on the ulusalb.urls patterns.

That being said, it might be better to make paths that do not overlap: imagine that you later have an object with firma as slug, then that object is not accessible, since firma/ will fire first for firma.urls.

Leave a comment