我是python的新手,我正在按照以下教程构建djangorestframework API http://www.django-rest-framework.org/tutorial/quickstart/ 我已经配置好了 Python 3.5 PIP 9.0.1 Django 2.0
教程/教程/ urls.py
from django.conf.urls import url, include
from django.contrib import users
from rest_framework import routers
router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
router.register(r'groups', views.GroupViewSet)
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
url(r'^', include(router.urls)),
url(r'^users/', user.site.urls),
]
错误:
文件" /home/pradeep/tutorial/tutorial/tutorial/urls.py" ;,第18行,在 来自django.contrib导入用户 ImportError:无法导入名称'用户'
答案 0 :(得分:0)
尝试更改
from django.contrib import users
要:
from django.contrib.auth.models import User