Django是用于前端还是后端? [英] Is Django for the frontend or backend?

查看:3524
本文介绍了Django是用于前端还是后端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常看到人们声称他们的后端是在Django中实现的,但是Django不应该用于前端吗?我假设后端是指业务逻辑,而前端是指表示.我想念什么吗?

I often see people claiming their backend is implemented in Django, but isn't Django supposed to be for the frontend? I'd assume the backend refers to the business logic where the frontend refers to the presentation. Am I missing something?

推荐答案

都不是.

Django是一个框架,而不是一种语言. Python是编写Django的语言.

Django is a framework, not a language. Python is the language in which Django is written.

Django是Python库的集合,可让您快速有效地创建高质量的Web应用程序,并且适用于前端和后端.

Django is a collection of Python libs allowing you to quickly and efficiently create a quality Web application, and is suitable for both frontend and backend.

但是,Django因其"Django admin"而闻名,这是一种自动生成的后端,使您可以在许多简单的用例中快速管理网站,而无需编写太多代码.

However, Django is pretty famous for its "Django admin", an auto generated backend that allows you to manage your website in a blink for a lot of simple use cases without having to code much.

更准确地说,对于前端,Django可以帮助您进行数据选择,格式化和显示.它具有URL管理,模板语言,身份验证机制,高速缓存挂钩以及各种导航工具(例如分页器)的功能.

More precisely, for the front end, Django helps you with data selection, formatting, and display. It features URL management, a templating language, authentication mechanisms, cache hooks, and various navigation tools such as paginators.

对于后端,Django带有ORM,可让您轻松操纵数据源,表单(独立于HTML的实现)来处理用户输入并验证数据和信号以及观察者模式的实现.加上大量针对用例的漂亮小工具.

For the backend, Django comes with an ORM that lets you manipulate your data source with ease, forms (an HTML independent implementation) to process user input and validate data and signals, and an implementation of the observer pattern. Plus a tons of use-case specific nifty little tools.

对于其余的Django后端工作,您只需使用常规Python.业务逻辑是一个相当宽泛的术语.

For the rest of the backend work Django doesn't help with, you just use regular Python. Business logic is a pretty broad term.

您可能还想知道Django带有应用程序的概念,这是一个自包含的可插拔Django库,可以解决问题. Django社区非常庞大,因此有许多应用程序可以执行普通Django无法执行的特定业务逻辑.

You probably want to know as well that Django comes with the concept of apps, a self contained pluggable Django library that solves a problem. The Django community is huge, and so there are numerous apps that do specific business logic that vanilla Django doesn't.

这篇关于Django是用于前端还是后端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆