Django URL-Konfig mutmaßlich richtig, "er" kann einen bestimmten Pfad dennoch nicht finden.

Django, Flask, Bottle, WSGI, CGI…
Antworten
AFX
User
Beiträge: 51
Registriert: Samstag 4. September 2021, 08:40

Bin gerade am Djangoprogrammieren, und nun wollte ich zu einem bestehenden Projekt eine neue app hinzufügen.

manage.py startapp agb

Danach habe ich in der urls.py-Datei meines Projekts folgendes unter urlpatterns eingetragen:

path('agb/', include('agb.urls')),

Anschließend habe ich in der settings.py unter INSTALLED_APPS 'agb', also den Namen der App, eingetragen.

Der sucht aber falsch. Denn es heißt:

Using the URLconf defined in myworld.urls, Django tried these URL patterns, in this order:

admin/
accounts/
agb/
accounts/
accounts/ [name='home']
The current path, agb, didn’t match any of these.
Dabei steht doch in meiner agb.urls.py folgendes:

Code: Alles auswählen

from django.urls import path
from . import views

urlpatterns = [
    path('agb/', views.reception),
]
Kennt jemand diesen Fehler oder hatte jemand sowas schonmal? Ich komme nicht drauf, wie das sein kann, denn agb ist doch in der Projekt-urls.py richtig eingetragen...
Benutzeravatar
__blackjack__
User
Beiträge: 14336
Registriert: Samstag 2. Juni 2018, 10:21
Wohnort: 127.0.0.1
Kontaktdaten:

Also laut Meldung: Probiert wurde "agb/" und der aktuelle Path ist "agb".
„Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.“ — Brian W. Kernighan
Antworten