Swagger navigation like https://petstore.swagger.io/#/pet doesn't work in my projects

233 views Asked by At

All the Swagger apps I've seen have navigation between endpoints-related blocks like this: https://petstore.swagger.io/#/store/getInventory

When you click on certain blocks the URL changes. Can't understand what I'm doing wrong, but I have nothing like this. My browser shows the same URL all the time, i.e. it's like 'https://petstore.swagger.io/' without #, etc.

Some example of how I'm using Swagger. To make sure it's not about my project, tried with a tutorial one, but it has the same problem

serializers.py:

class PostSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Post
        fields = ('author', 'title')

views.py:

class PostViewSet(viewsets.ModelViewSet):
    queryset = Post.objects.all()
    serializer_class = PostSerializer

urls.py:

router = DefaultRouter()
router.register('posts', views.PostViewSet)

schema_view = get_swagger_view(title='Posts API')

urlpatterns = [
    url('^$', schema_view),
    url(r'^', include(router.urls)),
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]

What I'm doing wrong? Thanks!!

1

There are 1 answers

1
tvgriek On BEST ANSWER