A Django REST framework API adapter for the App(IOS, Andorid, WebApp) API spec.
Project description
IOS&Andorid API and Django Rest Framework
Overview
App API support for Django REST Framework
Documentation: None
Format specification: http://jsonapi.org/format/
By default, Django REST Framework will produce a request like:
http://example.com/api/1.0/identities/?page=1
and then the response like:
{ "count": 200, "msg": "success!", "data": { "list": [ { "id": 3, "username": "john1", "full_name": "John Coltrane1" }, { "id": 4, "username": "john2", "full_name": "John Coltrane2" }, ], "total_count": 2, "total_pages": 1 } }
Goals
As a Django REST Framework APP API (short DJA) we are trying to address following goals:
Support the REST_FRAMEWORK_APPAPI to compliance
Be as compatible with Django REST Framework as possible
Have sane defaults to be as easy to pick up as possible
Be solid and tested with good coverage
Be performant
Requirements
Python (3.5, 3.6, 3.7)
Django (1.11, 2.1, 2.2)
Django REST Framework (3.10)
We highly recommend and only officially support the latest patch release of each Python, Django and REST Framework series.
Installation
From PyPI
$ pip install djangorestframework-appapi
From Source
$ git clone https://github.com/allran/djangorestframework-appapi.git $ cd django-rest-framework-app-api $ pip install -e .
Running the example app
It is recommended to create a virtualenv for testing. Assuming it is already installed and activated:
$ git clone https://github.com/allran/djangorestframework-appapi.git $ cd django-rest-framework-app-api $ pip install -U -e . -r requirements.txt $ django-admin migrate --settings=example.settings $ django-admin loaddata drf_example --settings=example.settings $ django-admin runserver --settings=example.settings
Browse to http://localhost:8000
Running Tests and linting
It is recommended to create a virtualenv for testing. Assuming it is already installed and activated:
$ pip install -Ur requirements.txt $ flake8 $ pytest
Usage
rest_framework_app_api assumes you are using class-based views in Django Rest Framework.
Settings
REST_FRAMEWORK = { 'PAGE_SIZE': 10, # rest_framework_json_api 'EXCEPTION_HANDLER': 'rest_framework_app_api.exceptions.exception_handler', 'DEFAULT_PAGINATION_CLASS': 'rest_framework_app_api.pagination.JsonApiPageNumberPagination', }
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for djangorestframework-appapi-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b303f367d3ed1743350ea8a6bafb36032917d0ce7ba9ec1d3a39b14a21787174 |
|
MD5 | 8683d002ef4643f0e41f2d774ae6f9cc |
|
BLAKE2b-256 | 9ed270a0f0881ee5f48a5f19dac2f4a4415c03799bcbe5ad20b9c13c58b44264 |
Hashes for djangorestframework_appapi-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd0afd6cb4f1d84aa33d98bba46a37052d8fcdd0e1649930625f2ac43c6a10dc |
|
MD5 | bbd4e77d0efc627aacb3e96a94131ac2 |
|
BLAKE2b-256 | a218a2faca3cc34aed594f2173a3750c8382789537768d26c90daeb8f91b13dd |