0

i use path instead of url in django 2.0 but there is a problem

Following is my code

oauth2_endpoint_views = ([
path('authorize/', oauth2_views.AuthorizationView.as_view(), name='authorize'),
path('token/', oauth2_views.TokenView.as_view(), name='token'),
path('revoke-token/', oauth2_views.RevokeTokenView.as_view, name='revoke-token'),
], 'oauth2')

    if settings.DEBUG:
oauth2_endpoint_views += ([
        path('application/', oauth2_views.ApplicationList.as_view(), name='list'),
        path('application/register', oauth2_views.ApplicationRegistration.as_view(), name='register'),
        path('application/<int:pk>/', oauth2_views.ApplicationDetail.as_view(), name='detail'),
        path('application/<int:pk>/delete/', oauth2_views.ApplicationDetail.as_view(), name='delete'),
        path('application/<int:pk>/update/', oauth2_views.ApplicationUpdate.as_view(), name='update'),
        path('authorized-tokens/', oauth2_views.AuthorizedTokensListView.as_view(), name='authorized-token-list'),
        path('authorized-tokens/<int:pk>/delete/', oauth2_views.AuthorizedTokenDeleteView.as_view(), name='authorized-token-delete'),
    ], 'oauth2')

I added path, but i can't found path application, application/register ...

how can i solve the problem?

fuzes
  • 1,777
  • 4
  • 20
  • 40

1 Answers1

0

Try replacing this:

path('application/register',oauth2_views.ApplicationRegistration.as_view(), name='register'),

with

path('application/register/', oauth2_views.ApplicationRegistration.as_view(), name='register'),
Vaygeth
  • 156
  • 8
  • Following is error message : Using the URLconf defined in onappscan.urls, Django tried these URL patterns, in this order: core/ api/ o/ authorize/ [name='authorize'] o/ token/ [name='token'] o/ revoke-token/ [name='revoke-token'] admin/ api-auth/ ^media\/(?P.*)$ ^static\/(?P.*)$ The current path, o/application/, didn't match any of these. I can't find url in settings.DEBUG – fuzes Dec 12 '17 at 06:03