Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide urls in Django Rest Framework api?

I am using DRF, and I want to noone know what urls my project has. So when you go to link like localhost:8000/api/ you can see browsable api, I already hide it by following settings:

'DEFAULT_RENDERER_CLASSES': (
    'rest_framework.renderers.JSONRenderer',
),

but it still shows me available urls in json format.

How to hide these urls?

like image 212
belek Avatar asked Nov 18 '15 16:11

belek


People also ask

How can you secure the Django REST framework based REST API?

User token endpoint The Django rest framework comes with an endpoint that users can use to generate their authentication tokens by providing their valid username and password. In the django_todo project directory add the API endpoint for token generation in the urls.py file.

What is renderers in Django REST framework?

The rendering process takes the intermediate representation of template and context, and turns it into the final byte stream that can be served to the client. REST framework includes a number of built in Renderer classes, that allow you to return responses with various media types.

What is Restapi in django?

Django REST framework (DRF) is a powerful and flexible toolkit for building Web APIs. Its main benefit is that it makes serialization much easier. Django REST framework is based on Django's class-based views, so it's an excellent option if you're familiar with Django.

What is HyperlinkedModelSerializer in django?

HyperlinkedModelSerializer is a layer of abstraction over the default serializer that allows to quickly create a serializer for a model in Django. Django REST Framework is a wrapper over default Django Framework, basically used to create APIs of various kinds.


1 Answers

You likely want to use SimpleRouter instead of DefaultRouter

like image 110
Linovia Avatar answered Sep 30 '22 12:09

Linovia