[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-2159":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":34,"lastSyncTime":35,"discoverSource":36},2159,"django-rest-framework","encode\u002Fdjango-rest-framework","encode","Web APIs for Django. 🎸","https:\u002F\u002Fwww.django-rest-framework.org",null,"Python",30063,7069,602,36,0,3,13,67,12,45,"Other",false,"main",true,[27,28,29,30],"api","django","python","rest","2026-06-12 02:00:38","# [Django REST framework][docs]\n\n[![build-status-image]][build-status]\n[![coverage-status-image]][codecov]\n[![pypi-version]][pypi]\n\n**Awesome web-browsable Web APIs.**\n\nFull documentation for the project is available at [https:\u002F\u002Fwww.django-rest-framework.org\u002F][docs].\n\n---\n\n# Overview\n\nDjango REST framework is a powerful and flexible toolkit for building Web APIs.\n\nSome reasons you might want to use REST framework:\n\n* The Web browsable API is a huge usability win for your developers.\n* [Authentication policies][authentication] including optional packages for [OAuth1a][oauth1-section] and [OAuth2][oauth2-section].\n* [Serialization][serializers] that supports both [ORM][modelserializer-section] and [non-ORM][serializer-section] data sources.\n* Customizable all the way down - just use [regular function-based views][functionview-section] if you don't need the [more][generic-views] [powerful][viewsets] [features][routers].\n* [Extensive documentation][docs], and [great community support][group].\n\n**Below**: *Screenshot from the browsable API*\n\n![Screenshot][image]\n\n----\n\n# Requirements\n\n* Python 3.10+\n* Django 4.2, 5.0, 5.1, 5.2, 6.0\n\nWe **highly recommend** and only officially support the latest patch release of\neach Python and Django series.\n\n# Installation\n\nInstall using `pip`...\n\n    pip install djangorestframework\n\nAdd `'rest_framework'` to your `INSTALLED_APPS` setting.\n\n```python\nINSTALLED_APPS = [\n    # ...\n    \"rest_framework\",\n]\n```\n\n# Example\n\nLet's take a look at a quick example of using REST framework to build a simple model-backed API for accessing users and groups.\n\nStart up a new project like so...\n\n    pip install django\n    pip install djangorestframework\n    django-admin startproject example .\n    .\u002Fmanage.py migrate\n    .\u002Fmanage.py createsuperuser\n\n\nNow edit the `example\u002Furls.py` module in your project:\n\n```python\nfrom django.contrib.auth.models import User\nfrom django.urls import include, path\nfrom rest_framework import routers, serializers, viewsets\n\n\n# Serializers define the API representation.\nclass UserSerializer(serializers.HyperlinkedModelSerializer):\n    class Meta:\n        model = User\n        fields = [\"url\", \"username\", \"email\", \"is_staff\"]\n\n\n# ViewSets define the view behavior.\nclass UserViewSet(viewsets.ModelViewSet):\n    queryset = User.objects.all()\n    serializer_class = UserSerializer\n\n\n# Routers provide a way of automatically determining the URL conf.\nrouter = routers.DefaultRouter()\nrouter.register(r\"users\", UserViewSet)\n\n# Wire up our API using automatic URL routing.\n# Additionally, we include login URLs for the browsable API.\nurlpatterns = [\n    path(\"\", include(router.urls)),\n    path(\"api-auth\u002F\", include(\"rest_framework.urls\", namespace=\"rest_framework\")),\n]\n```\n\nWe'd also like to configure a couple of settings for our API.\n\nAdd the following to your `settings.py` module:\n\n```python\nINSTALLED_APPS = [\n    # ... make sure to include the default installed apps here.\n    \"rest_framework\",\n]\n\nREST_FRAMEWORK = {\n    # Use Django's standard `django.contrib.auth` permissions,\n    # or allow read-only access for unauthenticated users.\n    \"DEFAULT_PERMISSION_CLASSES\": [\n        \"rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly\",\n    ]\n}\n```\n\nThat's it, we're done!\n\n    .\u002Fmanage.py runserver\n\nYou can now open the API in your browser at `http:\u002F\u002F127.0.0.1:8000\u002F`, and view your new 'users' API. If you use the `Login` control in the top right corner you'll also be able to add, create and delete users from the system.\n\nYou can also interact with the API using command line tools such as [`curl`](https:\u002F\u002Fcurl.haxx.se\u002F). For example, to list the users endpoint:\n\n    $ curl -H 'Accept: application\u002Fjson; indent=4' -u admin:password http:\u002F\u002F127.0.0.1:8000\u002Fusers\u002F\n    [\n        {\n            \"url\": \"http:\u002F\u002F127.0.0.1:8000\u002Fusers\u002F1\u002F\",\n            \"username\": \"admin\",\n            \"email\": \"admin@example.com\",\n            \"is_staff\": true,\n        }\n    ]\n\nOr to create a new user:\n\n    $ curl -X POST -d username=new -d email=new@example.com -d is_staff=false -H 'Accept: application\u002Fjson; indent=4' -u admin:password http:\u002F\u002F127.0.0.1:8000\u002Fusers\u002F\n    {\n        \"url\": \"http:\u002F\u002F127.0.0.1:8000\u002Fusers\u002F2\u002F\",\n        \"username\": \"new\",\n        \"email\": \"new@example.com\",\n        \"is_staff\": false,\n    }\n\n# Documentation & Support\n\nFull documentation for the project is available at [https:\u002F\u002Fwww.django-rest-framework.org\u002F][docs].\n\nFor questions and support, use the [REST framework discussion group][group], or `#restframework` on libera.chat IRC.\n\n# Security\n\nPlease see the [security policy][security-policy].\n\n[build-status-image]: https:\u002F\u002Fgithub.com\u002Fencode\u002Fdjango-rest-framework\u002Factions\u002Fworkflows\u002Fmain.yml\u002Fbadge.svg\n[build-status]: https:\u002F\u002Fgithub.com\u002Fencode\u002Fdjango-rest-framework\u002Factions\u002Fworkflows\u002Fmain.yml\n[coverage-status-image]: https:\u002F\u002Fimg.shields.io\u002Fcodecov\u002Fc\u002Fgithub\u002Fencode\u002Fdjango-rest-framework\u002Fmain.svg\n[codecov]: https:\u002F\u002Fcodecov.io\u002Fgithub\u002Fencode\u002Fdjango-rest-framework?branch=main\n[pypi-version]: https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fdjangorestframework.svg\n[pypi]: https:\u002F\u002Fpypi.org\u002Fproject\u002Fdjangorestframework\u002F\n[group]: https:\u002F\u002Fgroups.google.com\u002Fforum\u002F?fromgroups#!forum\u002Fdjango-rest-framework\n\n[funding]: https:\u002F\u002Ffund.django-rest-framework.org\u002Ftopics\u002Ffunding\u002F\n[sponsors]: https:\u002F\u002Ffund.django-rest-framework.org\u002Ftopics\u002Ffunding\u002F#our-sponsors\n\n[oauth1-section]: https:\u002F\u002Fwww.django-rest-framework.org\u002Fapi-guide\u002Fauthentication\u002F#django-rest-framework-oauth\n[oauth2-section]: https:\u002F\u002Fwww.django-rest-framework.org\u002Fapi-guide\u002Fauthentication\u002F#django-oauth-toolkit\n[serializer-section]: https:\u002F\u002Fwww.django-rest-framework.org\u002Fapi-guide\u002Fserializers\u002F#serializers\n[modelserializer-section]: https:\u002F\u002Fwww.django-rest-framework.org\u002Fapi-guide\u002Fserializers\u002F#modelserializer\n[functionview-section]: https:\u002F\u002Fwww.django-rest-framework.org\u002Fapi-guide\u002Fviews\u002F#function-based-views\n[generic-views]: https:\u002F\u002Fwww.django-rest-framework.org\u002Fapi-guide\u002Fgeneric-views\u002F\n[viewsets]: https:\u002F\u002Fwww.django-rest-framework.org\u002Fapi-guide\u002Fviewsets\u002F\n[routers]: https:\u002F\u002Fwww.django-rest-framework.org\u002Fapi-guide\u002Frouters\u002F\n[serializers]: https:\u002F\u002Fwww.django-rest-framework.org\u002Fapi-guide\u002Fserializers\u002F\n[authentication]: https:\u002F\u002Fwww.django-rest-framework.org\u002Fapi-guide\u002Fauthentication\u002F\n[image]: https:\u002F\u002Fwww.django-rest-framework.org\u002Fimg\u002Fquickstart.png\n\n[docs]: https:\u002F\u002Fwww.django-rest-framework.org\u002F\n[security-policy]: https:\u002F\u002Fgithub.com\u002Fencode\u002Fdjango-rest-framework\u002Fsecurity\u002Fpolicy\n","Django REST framework 是一个用于构建 Web API 的强大且灵活的工具包。其核心功能包括可浏览的 Web API、多种认证策略（如 OAuth1a 和 OAuth2）、支持 ORM 和非 ORM 数据源的序列化，以及高度可定制的视图和路由机制。该框架特别适合需要快速开发高质量 RESTful API 的 Django 项目，尤其适用于对开发者友好性和安全性有较高要求的应用场景。通过提供详尽的文档和支持活跃的社区，Django REST framework 成为了许多开发者构建高效、安全 Web 服务时的理想选择。",2,"2026-06-11 02:48:29","top_language"]