【发布时间】:2025-12-25 18:10:11
【问题描述】:
错误:从 django.conf.urls 导入 url ImportError: 无法从 '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 url django-rest-framework importerror django-rest-auth