简体   繁体   中英

Django Rest Framework Reversing URL

I have two files, one containing the URL like this

url(r'^users/', include('api_manager.users_urls', namespace='user'))

in second URL file i have this:

url(r'^', users_views.UsersList.as_view(), name='index')

When i hit the URL localhost:8000/api/users/ It redirect me to view 'UserList' and here i am using reverse function

reverse("user:index")

it returns me the /apiusers/ instead of /api/users/

Please let me know what is wrong in it.

I have resolved the issue, i find out that i am using api/* in my parent URL file, i just remove the '*' and reverse function returning the /api/users/

:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM