I am having problems with the example in the documentation.
When I try going to the default route "/", I keep getting a 404. The way the documentation example reads, I should be able to get a User list?
Here is the urls.py code:
from django.contrib import admin
from django.conf.urls import url, include
from django.contrib.auth.models import User
from rest_framework import routers, serializers, viewsets
# Serializers define the API representation.
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('username', 'email', 'is_staff')
# ViewSets define the view behavior.
class UserViewSet(viewsets.ModelViewSet):
queryset = User.objects.all()
serializer_class = UserSerializer
# Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register(r'users', UserViewSet)
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
url(r'^', include(router.urls)),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
]
I have the rest_framework
added to my application, too. I can see the various User related routes when I look at the router
object via the manage.py
shell, but I keep getting the 404.
I am implementing this in an existing new project, but I have yet to actually put anything in the project so I don't think the issue is there. My current set up is Nginx proxy -> Gunicorn -> Django. The \admin site works so it looks like other things are routed fine. Any advice would be great to help me along.
Edit: Image of the debug screen I am receiving. URL is masked out, but this is going to just the main site server/
.