Codync
무료 오픈소스 1:1 대안, Grok Bot과 Muse 대신
저장소 정보는 아직 수집하지 않았습니다.
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
Automatically create a REST API for your Django models
저장소 README에서 가져옴
README 전체를 불러오는 중입니다.
README 전문 보기 ↗Django Headless generates a REST API for your Django models, so Django can serve as the backend of a headless CMS. Decorate a model with @expose() and it gets list, detail, create, update and delete routes, with no serializers, viewsets or URL patterns to write.
Read the documentation at djangoheadless.org.
/api/blog.article/by_slug/<value>.@django-headless/client npm package.Install the package:
pip install django-headless
Add rest_framework, headless and headless.rest to INSTALLED_APPS:
# mysite/settings.py
INSTALLED_APPS = [
# ...
"rest_framework",
"headless",
"headless.rest",
]
Include the API in your URL configuration:
# mysite/urls.py
from django.urls import include, path
urlpatterns = [
# ...
path("api/", include("headless.rest.urls")),
]
Expose a model:
# blog/models.py
from django.db import models
from headless import expose
@expose()
class Article(models.Model):
title = models.CharField(max_length=200)
body = models.TextField()
published = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.title
Run python manage.py runserver; the article list is at /api/blog.article.
Generated routes answer 403 Forbidden to everyone but staff users, so an exposed model is never public by accident. To configure authentication or open the routes up, see Permissions.
@expose() options@django-headless/client npm packageHEADLESS settingTo contribute a change:
git checkout -b fix-boolean-casting.poetry run python scripts/test_wrapper.py test.Set up a development environment with Poetry:
git clone https://github.com/dwarsbit/django-headless.git
cd django-headless
poetry install
poetry run python scripts/test_wrapper.py test
The TypeScript client lives in client/, with its own tests:
cd client
npm ci
npm test
npm run typecheck
poetry run npm run e2e:next # against a Django project and a Next.js app
Writing for the README or the documentation follows STYLE.md.
Django Headless is licensed under the MIT License; see LICENSE.