Django Rest Docs显示错误的网址

时间:2016-11-05 19:42:16

标签: python django rest django-rest-framework api-design

我使用Django Rest Docs来描述我在Django Rest Framework中构建的API,但它显示的网址不正确。具体来说,他们预先/管理/一切:

enter image description here

这些路径应该是/ session-auth /,/ session /等。我不知道为什么/ admin /正在进行预制。这是我的urls.py文件:

# URLs for serving static media and user uploaded media
urlpatterns = patterns('',
    (r'^static/(?P<path>.*)$', 'django.views.static.serve',{'document_root': settings.STATIC_URL, 'show_indexes': True}),
) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)


urlpatterns += patterns('myapp.views',
    #Home page
    (r'^$', 'home'),

    url(r'^docs/', include('rest_framework_docs.urls')),

    # Refresh all locations
    (r'^admin/refresh-all-locations/$', 'refresh_all_locations'),
    # Admin all locations page
    (r'^admin/all-locations/$', admin.site.admin_view(all_locations)),
    # Admin
    (r'^admin/', include(admin.site.urls)),

    ####API urls####
    # Authenticate a user
    url(r'^session-auth/$', API.Session.SessionAuth.as_view(), name='authenticate'),
    # Update user password or email
    url(r'^session/$', API.Session.SessionDetail.as_view()),

    # Get the detail on one entity
    url(r'^entities/(?P<entity_id>[0-9]+)/$', API.Entity.EntityDetail.as_view()),

0 个答案:

没有答案