Answer the question
In order to leave comments, you need to log in
What if Django 4.0 says cannot import name 'url' from 'django.conf.urls' on rest_auth?
Good morning-afternoon.
What should I do if:
Django starting from version 4 gives - "cannot import name 'url' from 'django.conf.urls'" when creating url from rest_auth?
Main urls.py:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('api/v1/', include('posts.urls')),
path('api-auth/', include('rest_framework.urls')),
path('api/v1/rest-auth/', include('rest_auth.urls')),
]
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'posts',
'rest_framework',
'rest_framework.authtoken',
'rest_auth',
]
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.IsAuthenticated',
],
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.TokenAuthentication',
],
}
Answer the question
In order to leave comments, you need to log in
Well then rest_auth is something old, you don't need to use it, or use it with old versions of django, but what's the point?
I study Django Rest from the book "Django for APIs"Well, that's the problem of studying from books, over time, the information there becomes outdated, study from official docks.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question