Registry / web-framework / django-tastypie

django-tastypie

JSON →
library0.15.1pypypiunverified

A flexible & capable API layer for Django. Current version 0.15.1, maintained but with infrequent releases.

pip install django-tastypie
INSTALL
IMPORT
SIG · DJANGO-TASTYPIE
D
django-tastypie
web-frameworkpythonv0.15.1
Install
2.7s avg
Import
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.15.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 20.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.7s · import 0.000s · 21MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Api
from tastypie.api import Api
from tastypie.api import Api
Resource
from tastypie.resources import Resource
VERSION
from tastypie import VERSION

Minimal setup: define a ModelResource, register it on an Api instance, and include the urls.

import os os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings') import django django.setup() from tastypie.api import Api from tastypie.resources import ModelResource from myapp.models import MyModel class MyModelResource(ModelResource): class Meta: queryset = MyModel.objects.all() resource_name = 'mymodel' allowed_methods = ['get', 'post', 'put', 'delete'] authentication = ApiKeyAuthentication() authorization = DjangoAuthorization() api = Api(api_name='v1') api.register(MyModelResource()) # Then include in urls.py as: urlpatterns = [path('api/', include(api.urls))]
Debug
Known issues
gotchaModelResource.Meta.queryset is required and must be a QuerySet, not a manager.
fix
Use MyModel.objects.all() instead of MyModel.objects.
affects: all
gotchaSerialization of many-to-many fields requires explicit declaration in the resource fields.
fix
Add fields = ['m2m_field'] to the Meta class.
affects: all
gotchaTastypie does NOT support Django's new-style middleware (MIDDLEWARE setting). You must use MIDDLEWARE_CLASSES if you need tastypie middleware.
fix
Use MIDDLEWARE_CLASSES or upgrade to 0.15.0+ which adds partial compatibility.
affects: <=0.14.4
gotchaThe 'dehydrate' and 'hydrate' methods are for modifying serialized/deserialized data, not for validation.
fix
Use 'is_valid' or custom validation in 'obj_create'/'obj_update'.
affects: all
deprecatedThe 'authentication' and 'authorization' params in Meta are being replaced by class-based configurations in future releases.
fix
Check docs for updated patterns; currently both work.
affects: 0.14+
Upgrade
Version history
0.15.1latest on PyPI · released Feb 23, 2025
Audit
Dependencies
DjangorequiredCore dependency, tested with Django 2.2+ but works with later versions.
python-dateutilrequiredUsed for date/time serialization.
mimeparserequiredUsed for content-type negotiation.
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
django-tastypie — pip install django-tastypie · libregistry