使用路由器网址,“ django.core.exceptions.ImproperlyConfigured:”

时间:2019-04-25 17:24:52

标签: django-rest-framework django-urls

我正在基于此blog创建用户,我在api中使用以下网址,如下所示:

我的api / urls.py:

router = DefaultRouter()
router.register(r'users', UserViewSet)
urlpatterns = [
        url(r'^', include(router.urls)),
]

返回 '"%s" is not a valid regular expression: %s' % (regex, e) django.core.exceptions.ImproperlyConfigured: "^users\.(?P<format>[a-z0-9]+)/?\.(?P<format>[a-z0-9]+)/?$" is not a valid regular expression: redefinition of group name 'format' as group 2; was group 1 at position 37

0 个答案:

没有答案