Sto provando a fare l'autenticazione usando Django Rest Framework ma non riesco ad accedere tramite il pannello DRF. Quando cerco di arrivare alla pagina di login specificandou'rest_framework 'non è uno spazio dei nomi registrato
/api/api-auth/login/
NoReverseMatch at /api/api-auth/login/
u'rest_framework' is not a registered namespace
Request Method: GET
Request URL: http://127.0.0.1:8000/api/api-auth/login/
Django Version: 1.7.1
Exception Type: NoReverseMatch
Exception Value:
u'rest_framework' is not a registered namespace
Exception Location: /home/shivani/aubergine_cubii/test_rest_api2/forked_rest_api/venv/local/lib/python2.7/site-packages/django/core/urlresolvers.py in reverse, line 547
Python Executable: /home/shivani/aubergine_cubii/test_rest_api2/forked_rest_api/venv/bin/python
Python Version: 2.7.8
Python Path:
['/home/shivani/aubergine_cubii/test_rest_api2/forked_rest_api',
'/home/shivani/aubergine_cubii/test_rest_api2/forked_rest_api/venv/lib/python2.7',
'/home/shivani/aubergine_cubii/test_rest_api2/forked_rest_api/venv/lib/python2.7/plat-x86_64-linux-gnu',
'/home/shivani/aubergine_cubii/test_rest_api2/forked_rest_api/venv/lib/python2.7/lib-tk',
'/home/shivani/aubergine_cubii/test_rest_api2/forked_rest_api/venv/lib/python2.7/lib-old',
'/home/shivani/aubergine_cubii/test_rest_api2/forked_rest_api/venv/lib/python2.7/lib-dynload',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/home/shivani/aubergine_cubii/test_rest_api2/forked_rest_api/venv/local/lib/python2.7/site-packages',
'/home/shivani/aubergine_cubii/test_rest_api2/forked_rest_api/venv/lib/python2.7/site-packages']
Server time: Tue, 20 Jan 2015 10:52:13 +0000
urls.py
urlpatterns = patterns(
'',
url(r'^api/', include('api.urls', namespace='api')),
url(r'^admin/', include(admin.site.urls)),
url(r'^oauth2/', include('oauth2_provider.urls',
namespace='oauth2_provider'))
)
API/URL. py:
urlpatterns += [
url(r'^api-auth/', include('rest_framework.urls',
namespace='rest_framework')),
]
Cosa devo fare?
Ci potrebbe essere un problema nel tuo 'urls.py' ... Puoi mostrare come viene costruito' urlpatterns'? –
Aggiunto urls.py e api/urls.py in questione! @BernhardVallant –