ImportError: cannot import name 'url' from 'django.conf.urls' django-rest-auth
ImportError: cannot import name 'url' from 'django.conf.urls' django-rest-auth
错误:从 django.conf.urls 导入 url
导入错误:无法从 'django.conf.urls'
导入名称 'url'
-版本
Django==4.0.1
django-rest-auth==0.9.5
Pl help me.Thank you in advance
url.py
# Core Django imports
from django.contrib import admin
from django.urls import path, include
from django.urls import re_path,include
# from django.conf.urls import url,include
from django.conf import settings
# Rest framework imports
from rest_framework import permissions
# Simple JWT imports
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
schema_view = get_schema_view(
openapi.Info(
title="Heathy Living Guide API",
default_version='v1',
description="Heathy Living Guide",
),
public=True,
permission_classes=(permissions.AllowAny,),
)
urlpatterns = (
path('admin/', admin.site.urls),
path('api/authentication/', include('apps.authentication.urls'),authentication'),
path('api/users/', include('apps.users.urls'), name='users'),
path('rest-auth/', include('rest_auth.urls')),
# re_path(r'^rest-auth/', include('rest_auth.urls'))
)
urlpatterns += [
path('api/swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
path('api/redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc')
]
django-rest-auth 不支持 django 4.0。 django-rest-auth
看起来被遗弃了,最后一次提交是 3 年前。
Django-rest-auth is the original project, but is not currently
receiving updates.
Dj-rest-auth is a newer fork of the project.
如果您仍想使用 django-rest-auth,有几个已弃用的 API 调用需要替换:
django.conf.urls 使用
从 django.urls 导入 re_path 为 url
供 ugettext 使用
从django.utils.translation导入gettext_lazy作为_
为force_text使用
从 django.utils.encoding 导入 force_str 为 force_text
错误:从 django.conf.urls 导入 url 导入错误:无法从 'django.conf.urls'
导入名称 'url'-版本 Django==4.0.1 django-rest-auth==0.9.5
Pl help me.Thank you in advance
url.py
# Core Django imports
from django.contrib import admin
from django.urls import path, include
from django.urls import re_path,include
# from django.conf.urls import url,include
from django.conf import settings
# Rest framework imports
from rest_framework import permissions
# Simple JWT imports
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
schema_view = get_schema_view(
openapi.Info(
title="Heathy Living Guide API",
default_version='v1',
description="Heathy Living Guide",
),
public=True,
permission_classes=(permissions.AllowAny,),
)
urlpatterns = (
path('admin/', admin.site.urls),
path('api/authentication/', include('apps.authentication.urls'),authentication'),
path('api/users/', include('apps.users.urls'), name='users'),
path('rest-auth/', include('rest_auth.urls')),
# re_path(r'^rest-auth/', include('rest_auth.urls'))
)
urlpatterns += [
path('api/swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
path('api/redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc')
]
django-rest-auth 不支持 django 4.0。 django-rest-auth
看起来被遗弃了,最后一次提交是 3 年前。
Django-rest-auth is the original project, but is not currently receiving updates.
Dj-rest-auth is a newer fork of the project.
如果您仍想使用 django-rest-auth,有几个已弃用的 API 调用需要替换:
django.conf.urls 使用
从 django.urls 导入 re_path 为 url
供 ugettext 使用
从django.utils.translation导入gettext_lazy作为_
为force_text使用
从 django.utils.encoding 导入 force_str 为 force_text