Web Analytics

django-shinobi

⭐ 300 stars French by pmdevita

Rapide à apprendre, rapide à coder, rapide à exécuter

Test Couverture Version PyPI Téléchargements Discord

Django Shinobi - Framework REST Django rapide

Documentation

Django Shinobi est un framework web pour construire des API avec Django et les annotations de type Python 3.6+.

C'est un fork de la fantastique bibliothèque Django Ninja axé sur les fonctionnalités et corrections souhaitées par la communauté. Consultez la liste des différences si vous venez de Ninja, ainsi que la feuille de route !

Fonctionnalités clés :

Django Shinobi REST Framework

Documentation : https://pmdevita.github.io/django-shinobi


Installation

Dans votre projet Django, ajoutez Django Shinobi.

pip install django-shinobi
ou démarrer un nouveau projet.

pip install django django-shinobi
django-admin startproject apidemo

Utilisation

Dans votre projet Django, à côté de urls.py, créez un nouveau fichier appelé api.py.

from ninja import NinjaAPI

api = NinjaAPI()

@api.get("/add") def add(request, a: int, b: int): return {"result": a + b}

Now go to urls.py and add the following:

``Python hl_lines="3 7" ... from .api import api

urlpatterns = [ path("admin/", admin.site.urls), path("api/", api.urls), # <---------- ! ]


C'est tout !

Vous venez de créer une API qui :

  • reçoit une requête HTTP GET sur /api/add
  • prend, valide et convertit les paramètres GET a et b
  • décode le résultat en JSON
  • génère un schéma OpenAPI pour l'opération définie

Documentation interactive de l'API

Lancez votre projet Django

shell python manage.py runsever ``

Allez maintenant sur http://127.0.0.1:8000/api/docs

Vous verrez la documentation API interactive automatique (fournie par Swagger UI ou Redoc) :

Swagger UI

Et ensuite ?

--- Tranlated By Open Ai Tx | Last indexed: 2026-04-13 ---