hi Thanks for your reply. 

Now i've fixed that issue, and i'm getting a new one....

Unhandled exception in thread started by <function 
check_errors.<locals>.wrapper at 0x000002C71F682BF8>
Traceback (most recent call last):
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\urls\resolvers.py",
 
line 105, in _compile
    return re.compile(regex, re.UNICODE)
  File "C:\Tools\Anaconda3\envs\django-env\lib\re.py", line 233, in compile
    return _compile(pattern, flags)
  File "C:\Tools\Anaconda3\envs\django-env\lib\re.py", line 301, in _compile
    p = sre_compile.compile(pattern, flags)
  File "C:\Tools\Anaconda3\envs\django-env\lib\sre_compile.py", line 562, 
in compile
    p = sre_parse.parse(p, flags)
  File "C:\Tools\Anaconda3\envs\django-env\lib\sre_parse.py", line 855, in 
parse
    p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
  File "C:\Tools\Anaconda3\envs\django-env\lib\sre_parse.py", line 416, in 
_parse_sub
    not nested and not items))
  File "C:\Tools\Anaconda3\envs\django-env\lib\sre_parse.py", line 759, in 
_parse
    raise source.error(err.msg, len(name) + 1) from None
sre_constants.error: redefinition of group name 'format' as group 2; was 
group 1 at position 40

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\utils\autoreload.py",
 
line 228, in wrapper
    fn(*args, **kwargs)
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\core\management\commands\runserver.py",
 
line 125, in inner_run
    self.check(display_num_errors=True)
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\core\management\base.py",
 
line 359, in check
    include_deployment_checks=include_deployment_checks,
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\core\management\base.py",
 
line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\core\checks\registry.py",
 
line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\core\checks\urls.py",
 
line 16, in check_url_config
    return check_resolver(resolver)
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\core\checks\urls.py",
 
line 26, in check_resolver
    return check_method()
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\urls\resolvers.py",
 
line 255, in check
    warnings.extend(check_resolver(pattern))
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\core\checks\urls.py",
 
line 26, in check_resolver
    return check_method()
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\urls\resolvers.py",
 
line 255, in check
    warnings.extend(check_resolver(pattern))
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\core\checks\urls.py",
 
line 26, in check_resolver
    return check_method()
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\urls\resolvers.py",
 
line 255, in check
    warnings.extend(check_resolver(pattern))
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\core\checks\urls.py",
 
line 26, in check_resolver
    return check_method()
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\urls\resolvers.py",
 
line 172, in check
    warnings = self._check_pattern_startswith_slash()
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\urls\resolvers.py",
 
line 140, in _check_pattern_startswith_slash
    regex_pattern = self.regex.pattern
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\urls\resolvers.py",
 
line 93, in __get__
    instance.__dict__['regex'] = self._compile(instance._regex)
  File 
"C:\Tools\Anaconda3\envs\django-env\lib\site-packages\django\urls\resolvers.py",
 
line 109, in _compile
    (regex, six.text_type(e))
django.core.exceptions.ImproperlyConfigured: 
"^snippets\.(?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 40




在 2017年11月16日星期四 UTC+8下午9:31:29,Xavier Ordoquy写道:
>
> Hi,
>
> The tutorial has no mention of renderer_class but has renderer_classes 
> (note the extra ES at the end).
>
> Regards,
> Xavier.
>
> Le 16 nov. 2017 à 14:17, YUN TANG <[email protected] <javascript:>> a 
> écrit :
>
> I've been following the official tutorial until 6-viewsets-and-routers/ 
> <http://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/>
>
> After I changed the urls.py to
>
> router = DefaultRouter()
>
> router.register(r'snippets', views.SnippetViewSet)
> router.register(r'users', views.UserViewSet)
>
> # The API URLs are now determined automatically by the router
> # Additionally, we include the login URLs for the browsable API.
> urlpatterns = [
>     url(r'^', include(router.urls)),
> ]
>
>
> I got an error: 
> TypeError: SnippetViewSet() received an invalid keyword 'renderer_class'
>
>
> Please help. 
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django REST framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to