简体   繁体   English

了解如何将Backbone JS与Python Crud应用程序集成

[英]Understanding how to integrate Backbone JS with a Python crud app

I'm building a crud app using Python and Django. 我正在使用Python和Django构建一个Crud应用程序。 I want to use Backbone to access the api, grab the user data and render it accordingly. 我想使用Backbone访问api,获取用户数据并进行相应渲染。 I'm new to Backbone and had some questions on a high level: 我是Backbone的新手,在较高级别上有一些问题:

1) What advantage does Backbone provide that I can't do with regular Javascript? 1)Backbone提供了我无法使用常规Javascript做到的哪些优势?

2) I understand that Models and Collections make up the M in the MVC layer in Backbone, but lets say I have a User model written in Python, would I still need Models and Collections in Backbone or just Collections? 2)我知道模型和集合构成了Backbone的MVC层中的M,但是可以说我有一个用Python编写的用户模型,我是否仍然需要Backbone中的模型和集合,还是仅需要Collections? Are the Models of Backbone the same as the Models in Python? 骨干模型与Python中的模型相同吗?

I need help understanding the difference and uses in a simple way. 我需要帮助,以简单的方式了解它们的区别和用法。

Backbone is a really nice frontend framework that allows you to work with websockets and the like. Backbone是一个非常不错的前端框架,可让您使用websockets等。

Backbone is a frontend framework that does not need "direct" access to the db. 骨干网是一个前端框架,不需要“直接”访问数据库。 It will work with django models using either django rest framework, or websockets(redis, tornado, etc.). 它将与使用django rest框架或websockets(redis,龙卷风等)的django模型一起使用。 Backbone models can be just representations of data from the backend, it's how backbone deals with the serialized data passed from the server. 骨干模型可以只是后端数据的表示,这就是骨干网如何处理从服务器传递来的序列化数据。 It's MCRVT (Model collection routes views template). 它是MCRVT(模型集合路线视图模板)。

TL:DR; TL:DR; Backbone models are representations of restful resources. 骨干模型是静态资源的表示。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM