
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
django-api-framework
Advanced tools
Django Easy API - Easy and Fast Django REST framework based on Django-ninja-extra
Django-Ninja features:
Easy: Designed to be easy to use and intuitive.
FAST execution: Very high performance thanks to Pydantic and async support.
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.
Plus Extra:
Class Based: Design your APIs in a class based fashion.
Permissions: Protect endpoint(s) at ease with defined permissions and authorizations at route level or controller level.
Dependency Injection: Controller classes supports dependency injection with python Injector or django_injector. Giving you the ability to inject API dependable services to APIController class and utilizing them where needed
pip install django-api-framework
Then add "easy" to your django INSTALLED_APPS:
[
...,
"easy",
...,
]
In your Django project next to urls.py create new apis.py file:
from easy.main import EasyAPI
api_admin_v1 = EasyAPI(
urls_namespace="admin_api",
version="v1.0.0",
)
# Automatic Admin API generation
api_admin_v1.auto_create_admin_controllers()
Go to urls.py and add the following:
from django.urls import path
from .apis import api_admin_v1
urlpatterns = [
path("admin/", admin.site.urls),
path("api_admin/v1/", api_admin_v1.urls), # <---------- !
]
Now go to http://127.0.0.1:8000/api_admin/v1/docs
You will see the automatic interactive API documentation (provided by Swagger UI).
A boilerplate Django project for quickly getting started, and get production ready easy-apis with 100% test coverage UP and running: https://github.com/freemindcore/django-easy-api
If you find this project useful, please give your stars to support this open-source project. :) Thank you !
If CRUD_API_ENABLED_ALL_APPS
is set to True (default), all app models CRUD apis will be generated.
Apps in the CRUD_API_EXCLUDE_APPS
list, will always be excluded.
If CRUD_API_ENABLED_ALL_APPS
is set to False, only apps in the CRUD_API_INCLUDE_APPS
list will have CRUD apis generated.
Also, configuration is possible for each model, via APIMeta class:
generate_crud
: whether to create crud api, default to Truemodel_exclude
: fields to be excluded in Schemamodel_fields
: fields to be included in Schema, default to "__all__"
model_join
: prefetch and retrieve all m2m fields, default to Falsemodel_recursive
: recursively retrieve FK/OneToOne fields, default to Falsesensitive_fields
: fields to be ignoredExample:
class Category(TestBaseModel):
title = models.CharField(max_length=100)
status = models.PositiveSmallIntegerField(default=1, null=True)
class APIMeta:
generate_crud = True
model_fields = ["field_1", "field_2",] # if not configured default to "__all__"
model_join = True
model_recursive = True
sensitive_fields = ["password", "sensitive_info"]
By inheriting CrudAPIController
class, CRUD APIs can be added to any API controller.
Configuration is available via APIMeta
inner class in your Controller, same as the above APIMeta
inner class defined in your Django models.
Example:
@api_controller("event_api", permissions=[AdminSitePermission])
class EventAPIController(CrudAPIController):
def __init__(self, service: EventService):
super().__init__(service)
class APIMeta:
model = Event # django model
generate_crud = True # whether to create crud api, default to True
model_fields = ["field_1", "field_2",] # if not configured default to "__all__"
model_join = True
model_recursive = True
sensitive_fields = ["password", "sensitive_info"]
Please check tests/demo_app for more examples.
FAQs
Django Easy API - Easy and Fast Django REST framework based on Django-ninja-extra
We found that django-api-framework demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.