简体   繁体   English

我是否需要在 Django 上使用 REST 框架?

[英]Do I need to use REST framework on Django?

Do I need to use the REST framework on Django, if I were to use a front-end framework such as React and database engine such as MongoDB or PostgreSQL? Do I need to use the REST framework on Django, if I were to use a front-end framework such as React and database engine such as MongoDB or PostgreSQL? I also don't fully understand what a REST framework is.我也不完全理解 REST 框架是什么。

No. You don't have to, django is able to process requests, and manage database connections by itself.不,您不必这样做,django 能够自行处理请求并管理数据库连接。 You could build a complete API without using django rest framework at all, that could do anything that you could do with django rest framework. You could build a complete API without using django rest framework at all, that could do anything that you could do with django rest framework.

But.但。 DRF adds a lot of stuff that would make developing such a back-end alot faster. DRF 添加了很多东西,可以更快地开发这样的后端。 It has lots of features that make building common use cases quick, such as serializing/deserialzing requests, CRUD operations etc. Django can also do some of this, but DRF is specifically designed for building out an API.它有许多可以快速构建常见用例的功能,例如序列化/反序列化请求、CRUD 操作等。Django 也可以做到这一点,但 DRF 专为构建 API 而设计。

REST refers to a RESTful API. REST 指的是 RESTful API。 SO DRF is a framework that is useful for building restful APIs. SO DRF 是一个可用于构建 RESTful API 的框架。 What a restful API is, is a fairly big question in and of itself.多么宁静的 API 本身就是一个相当大的问题。 It stands for REpresentational State Transfer, but could best be described better than I can do here.它代表 REpresentational State Transfer,但最好比我在这里做的更好。 Maybe checkout this answer here: What is REST?也许在这里查看这个答案: 什么是 REST? Slightly confused 有点困惑

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果我使用JWT Django,我是否仍需要使用cookie和会话? - Do I still Need To use cookies and session if i use JWT Django rest_framework 我是否需要在 Django Rest Framework 序列化程序更新中明确使用事务? - Do I need to explicitly use transactions with Django Rest Framework serializer updates? Django rest框架:我真的需要两个单独的序列化器吗? - Django rest framework: Do I really need two separate serializers? Django rest 框架我需要在响应之前关闭文件吗 - Django rest framework do I need to close file before the response 如何在Django Rest Framework中使用GenericRelation? - How do I use GenericRelation with Django Rest Framework? 如何使用 django rest 框架发送文件作为响应? - How do I use django rest framework to send a file in response? Django Rest Framework 如何获取我在 URL 中使用的 ID - Django Rest Framework how do I get the id I use in the URL 我可以在测试 Django Rest Framework 时避免身份验证的需要吗 - Can I avoid the need for authentication when testing Django Rest Framework 如何在Django Rest Framework中正确使用mongoengine嵌入式文档 - How do I properly use mongoengine embedded document in Django Rest Framework 如何使用每个帐户(而非用户)具有API密钥的Django Rest框架? - How do I use an Django Rest Framework with API key per account (not user)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM