adrf-0.1.0
توضیحات
Async support for Django REST framework
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | adrf-0.1.0 |
| نام | adrf |
| نسخه کتابخانه | 0.1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Enrico Massa |
| ایمیل نویسنده | enrico.massa@gmail.com |
| آدرس صفحه اصلی | https://github.com/em1208/adrf |
| آدرس اینترنتی | https://pypi.org/project/adrf/ |
| مجوز | MIT |
# Async Django REST framework
**Async support for Django REST framework**
# Requirements
* Python 3.8+
* Django 4.1
We **highly recommend** and only officially support the latest patch release of
each Python and Django series.
# Installation
Install using `pip`...
pip install adrf
Add `'adrf'` to your `INSTALLED_APPS` setting.
```python
INSTALLED_APPS = [
...
'adrf',
]
```
# Example
# Async Views
When using Django 4.1 and above, this package allows you to work with async class and function based views.
For class based views, all handler methods must be async, otherwise Django will raise an exception. For function based views, the function itself must be async.
For example:
from adrf.views import APIView
class AsyncView(APIView):
async def get(self, request):
return Response({"message": "This is an async class based view."})
from adrf.decorators import api_view
@api_view(['GET'])
async def async_view(request):
return Response({"message": "This is an async function based view."})
نیازمندی
| مقدار | نام |
|---|---|
| >=4.1 | django |
| >=3.14.0 | djangorestframework |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl adrf-0.1.0:
pip install adrf-0.1.0.whl
نصب پکیج tar.gz adrf-0.1.0:
pip install adrf-0.1.0.tar.gz