Skip to main content

Fast Django Routing

Project description

Django Auto Router

Fast Django Routing.

DAR (Django Auto Router) is a simple library for easy routing DRF (Django REST Framework) views and viewsets.


DAR requires:

  • Python 3.6+
  • Django 3.0+
  • Django REST Framework


Install using pip.

pip install djangoautorouter

Add 'auto_router' to your INSTALLED APPS.



  1. You should create a in your main app:
from auto_router import Router

router_v2 = AutoRouter("api/v2/", namespace="api-v2")
router_v1 = AutoRouter("api/v1/", namespace="api-v1")
  1. Add it to your
from django.contrib import admin
from django.urls import path, include

from .routers import main_router, router

urlpatterns = [
  1. Then, from your in any of your apps, you can route it by using:
from rest_framework import generics, mixins, viewsets

from main.routers import router_v1

from . import models, serializers

@router_v1.route_view("cinema/list-movies/", "movie-list")
class ListMovies(generics.ListAPIView):
    queryset = models.Movie.objects.all()
    serializer_class = serializers.MovieSerializer

@router_v1.route_viewset("cinema/movies", "movies")
class MovieViewSet(viewsets.ModelViewSet):
    serializer_class = serializers.MovieSerializer
    queryset = models.Movie.objects.all()
  1. Call it:
GET http://localhost:8000/api/v1/cinema/list-movies/
POST http://localhost:8000/api/v1/cinema/movies/

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djangoautorouter-0.1.tar.gz (3.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page