[Answered ]-Why won't the urls.py file in my Django project let me import this file?

1👍

Here is one way to do it that should work. I have used path for consistency but it shouldn’t matter. path is easier to work with.

apps/accounts/urls.py

from django.urls import include, path

urlpatterns = [
    path('api/v1', include('djoser.urls')),
    path('api/v1', include('djoser.urls.authtoken'))
]

urls.py

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

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('apps.accounts.urls'))
]

Note that I changed accounts_urlpatterns to urlpatterns for this to work.

Leave a comment