<a href="https://github.com/vitalik/django-ninja/issues/383"><img width="814" alt="SCR-20230123-m1t" src="https://user-images.githubusercontent.com/95222/214056666-585c0479-c122-4cb3-add4-b8844088ccdd.png"></a>
<a href="https://github.com/vitalik/django-ninja/issues/383">^ Please read ^</a>
<p align="center">
<a href="https://django-ninja.dev/"><img src="https://django-ninja.dev/img/logo-big.png"></a>
</p>
<p align="center">
<em>Fast to learn, fast to code, fast to run</em>
</p>
![Test](https://github.com/vitalik/django-ninja/actions/workflows/test_full.yml/badge.svg)
![Coverage](https://img.shields.io/codecov/c/github/vitalik/django-ninja)
[![PyPI version](https://badge.fury.io/py/django-ninja.svg)](https://badge.fury.io/py/django-ninja)
[![Downloads](https://static.pepy.tech/personalized-badge/django-ninja?period=month&units=international_system&left_color=black&right_color=brightgreen&left_text=downloads/month)](https://pepy.tech/project/django-ninja)
# Django Ninja - Fast Django REST Framework
# v1.0 What's new
Read more details here - https://django-ninja.dev/whatsnew_v1/
Or Watch here:
<a href="https://youtu.be/GrIpDXPG41o"><img width="500" alt="SCR-20231116-qmoj" src="https://github.com/vitalik/django-ninja/assets/95222/06958fbf-6d3a-4f33-aa76-7a29279c9959"></a>
**Django Ninja** is a web framework for building APIs with **Django** and Python 3.6+ **type hints**.
**Key features:**
- **Easy**: Designed to be easy to use and intuitive.
- **FAST execution**: Very high performance thanks to **<a href="https://pydantic-docs.helpmanual.io" target="_blank">Pydantic</a>** and **<a href="/docs/docs/guides/async-support.md">async support</a>**.
- **Fast to code**: Type hints and automatic docs lets you focus only on business logic.
- **Standards-based**: Based on the open standards for APIs: **OpenAPI** (previously known as Swagger) and **JSON Schema**.
- **Django friendly**: (obviously) has good integration with the Django core and ORM.
- **Production ready**: Used by multiple companies on live projects (If you use django-ninja and would like to publish your feedback, please email ppr.vitaly@gmail.com).
![Django Ninja REST Framework](docs/docs/img/benchmark.png)
**Documentation**: https://django-ninja.dev
---
## Installation
```
pip install django-ninja
```
## Usage
In your django project next to urls.py create new `api.py` file:
```Python
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), # <---------- !
]
```
**That's it !**
Now you've just created an API that:
- receives an HTTP GET request at `/api/add`
- takes, validates and type-casts GET parameters `a` and `b`
- decodes the result to JSON
- generates an OpenAPI schema for defined operation
### Interactive API docs
Now go to <a href="http://127.0.0.1:8000/api/docs" target="_blank">http://127.0.0.1:8000/api/docs</a>
You will see the automatic interactive API documentation (provided by <a href="https://github.com/swagger-api/swagger-ui" target="_blank">Swagger UI</a> or <a href="https://github.com/Redocly/redoc" target="_blank">Redoc</a>):
![Swagger UI](docs/docs/img/index-swagger-ui.png)
## What next?
- Read the full documentation here - https://django-ninja.dev
- To support this project, please give star it on Github. ![github star](docs/docs/img/github-star.png)
- Share it [via Twitter](https://twitter.com/intent/tweet?text=Check%20out%20Django%20Ninja%20-%20Fast%20Django%20REST%20Framework%20-%20https%3A%2F%2Fdjango-ninja.dev)
- If you already using django-ninja, please share your feedback to ppr.vitaly@gmail.com
Raw data
{
"_id": null,
"home_page": "https://django-ninja.dev",
"name": "django-ninja",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Vitaliy Kucheryaviy",
"author_email": "ppr.vitaly@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9c/77/89ee4ebaa5151b7d85cebaf8d6ec0b9e5074326c3ad8259c763763306d51/django_ninja-1.3.0.tar.gz",
"platform": null,
"description": "<a href=\"https://github.com/vitalik/django-ninja/issues/383\"><img width=\"814\" alt=\"SCR-20230123-m1t\" src=\"https://user-images.githubusercontent.com/95222/214056666-585c0479-c122-4cb3-add4-b8844088ccdd.png\"></a>\n\n\n\n<a href=\"https://github.com/vitalik/django-ninja/issues/383\">^ Please read ^</a>\n\n\n\n\n<p align=\"center\">\n <a href=\"https://django-ninja.dev/\"><img src=\"https://django-ninja.dev/img/logo-big.png\"></a>\n</p>\n<p align=\"center\">\n <em>Fast to learn, fast to code, fast to run</em>\n</p>\n\n\n![Test](https://github.com/vitalik/django-ninja/actions/workflows/test_full.yml/badge.svg)\n![Coverage](https://img.shields.io/codecov/c/github/vitalik/django-ninja)\n[![PyPI version](https://badge.fury.io/py/django-ninja.svg)](https://badge.fury.io/py/django-ninja)\n[![Downloads](https://static.pepy.tech/personalized-badge/django-ninja?period=month&units=international_system&left_color=black&right_color=brightgreen&left_text=downloads/month)](https://pepy.tech/project/django-ninja)\n\n# Django Ninja - Fast Django REST Framework\n\n# v1.0 What's new\nRead more details here - https://django-ninja.dev/whatsnew_v1/ \n\nOr Watch here:\n\n\n<a href=\"https://youtu.be/GrIpDXPG41o\"><img width=\"500\" alt=\"SCR-20231116-qmoj\" src=\"https://github.com/vitalik/django-ninja/assets/95222/06958fbf-6d3a-4f33-aa76-7a29279c9959\"></a>\n\n\n\n**Django Ninja** is a web framework for building APIs with **Django** and Python 3.6+ **type hints**.\n\n\n **Key features:**\n\n - **Easy**: Designed to be easy to use and intuitive.\n - **FAST execution**: Very high performance thanks to **<a href=\"https://pydantic-docs.helpmanual.io\" target=\"_blank\">Pydantic</a>** and **<a href=\"/docs/docs/guides/async-support.md\">async support</a>**.\n - **Fast to code**: Type hints and automatic docs lets you focus only on business logic.\n - **Standards-based**: Based on the open standards for APIs: **OpenAPI** (previously known as Swagger) and **JSON Schema**.\n - **Django friendly**: (obviously) has good integration with the Django core and ORM.\n - **Production ready**: Used by multiple companies on live projects (If you use django-ninja and would like to publish your feedback, please email ppr.vitaly@gmail.com).\n\n\n\n![Django Ninja REST Framework](docs/docs/img/benchmark.png)\n\n**Documentation**: https://django-ninja.dev\n\n---\n\n## Installation\n\n```\npip install django-ninja\n```\n\n\n\n## Usage\n\n\nIn your django project next to urls.py create new `api.py` file:\n\n```Python\nfrom ninja import NinjaAPI\n\napi = NinjaAPI()\n\n\n@api.get(\"/add\")\ndef add(request, a: int, b: int):\n return {\"result\": a + b}\n```\n\n\nNow go to `urls.py` and add the following:\n\n\n```Python hl_lines=\"3 7\"\n...\nfrom .api import api\n\nurlpatterns = [\n path(\"admin/\", admin.site.urls),\n path(\"api/\", api.urls), # <---------- !\n]\n```\n\n**That's it !**\n\nNow you've just created an API that:\n\n - receives an HTTP GET request at `/api/add`\n - takes, validates and type-casts GET parameters `a` and `b`\n - decodes the result to JSON\n - generates an OpenAPI schema for defined operation\n\n### Interactive API docs\n\nNow go to <a href=\"http://127.0.0.1:8000/api/docs\" target=\"_blank\">http://127.0.0.1:8000/api/docs</a>\n\nYou will see the automatic interactive API documentation (provided by <a href=\"https://github.com/swagger-api/swagger-ui\" target=\"_blank\">Swagger UI</a> or <a href=\"https://github.com/Redocly/redoc\" target=\"_blank\">Redoc</a>):\n\n\n![Swagger UI](docs/docs/img/index-swagger-ui.png)\n\n## What next?\n\n - Read the full documentation here - https://django-ninja.dev\n - To support this project, please give star it on Github. ![github star](docs/docs/img/github-star.png)\n - Share it [via Twitter](https://twitter.com/intent/tweet?text=Check%20out%20Django%20Ninja%20-%20Fast%20Django%20REST%20Framework%20-%20https%3A%2F%2Fdjango-ninja.dev)\n - If you already using django-ninja, please share your feedback to ppr.vitaly@gmail.com\n",
"bugtrack_url": null,
"license": null,
"summary": "Django Ninja - Fast Django REST framework",
"version": "1.3.0",
"project_urls": {
"Documentation": "https://django-ninja.dev",
"Homepage": "https://django-ninja.dev",
"Repository": "https://github.com/vitalik/django-ninja"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "0072fd2589323b40893d3224e174eeec0c4ce5a42c7d2d384d11ba269ad4d050",
"md5": "20acba9dd4741bdae746d6f37fd87546",
"sha256": "f58096b6c767d1403dfd6c49743f82d780d7b9688d9302ecab316ac1fa6131bb"
},
"downloads": -1,
"filename": "django_ninja-1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "20acba9dd4741bdae746d6f37fd87546",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 2423381,
"upload_time": "2024-08-15T09:15:02",
"upload_time_iso_8601": "2024-08-15T09:15:02.396560Z",
"url": "https://files.pythonhosted.org/packages/00/72/fd2589323b40893d3224e174eeec0c4ce5a42c7d2d384d11ba269ad4d050/django_ninja-1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9c7789ee4ebaa5151b7d85cebaf8d6ec0b9e5074326c3ad8259c763763306d51",
"md5": "179b1e838251d6b08761550b0eb454ac",
"sha256": "5b320e2dc0f41a6032bfa7e1ebc33559ae1e911a426f0c6be6674a50b20819be"
},
"downloads": -1,
"filename": "django_ninja-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "179b1e838251d6b08761550b0eb454ac",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 3702324,
"upload_time": "2024-08-15T09:15:04",
"upload_time_iso_8601": "2024-08-15T09:15:04.464743Z",
"url": "https://files.pythonhosted.org/packages/9c/77/89ee4ebaa5151b7d85cebaf8d6ec0b9e5074326c3ad8259c763763306d51/django_ninja-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-15 09:15:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vitalik",
"github_project": "django-ninja",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "django-ninja"
}