I am currently using django 4.0 getting this error while including ('rest_auth.urls')

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

urlpatterns = [
    path('admin/', admin.site.urls),
    path("",include("Users.urls")),
    path('api/v1/rest-auth/', include('rest_auth.urls')),

    ]

Error:-ImportError: cannot import name ‘url’ from ‘django.conf.urls’

>Solution :

In rest_auth.urls do this:

from rest_framework.routers import DefaultRouter

router = DefaultRouter()
app_name = 'recipe'

urlpatterns = [
    path('',include(router.urls)),
]

Hope your problem will solve now.

Leave a Reply