热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

为什么我需要一个单独的Django网络服务器?-WhywouldIneedaseparatewebserverforDjango?

InoticedthatmostofthebooksandtutorialsonDjangomakeitveryclearthatuseDjangodevelopm

I noticed that most of the books and tutorials on Django make it very clear that use Django development server as a normal webserver is not OK. But some state that other webservers are optional, that we can use Django server to put the website on the web for everybody to see.

我注意到Django上的大多数书籍和教程都非常清楚地表明将Django开发服务器用作普通的网络服务器是不行的。但有些人认为其他网络服务器是可选的,我们可以使用Django服务器将网站放在网上供所有人查看。

But why exactly? Why do I need (or not) to use Apache, Lighttpd, Nginx, etc. in front of Django - WSGI?

但为什么呢?为什么我需要(或不)在Django-WSGI前面使用Apache,Lighttpd,Nginx等?

Is Django server not safe in some way? If so, how it is unsafe exactly, and why can't Django just come with a more robust webserver (out of the box, ready to use)?

Django服务器在某种程度上不安全吗?如果是这样,它究竟是不安全的,为什么Django不能只带来更强大的网络服务器(开箱即用,随时可以使用)?

How exactly those webservers help Django? *I know that those webservers have very useful mods, but AGAIN: couldn't Django just come with a safer "mod-able" webserver?

这些网络服务器究竟如何帮助Django? *我知道那些网络服务器有非常有用的mod,但是AGAIN:Django不能带来更安全的“可修改”网络服务器吗?

3 个解决方案

#1


4  

It comes down to the goal of the Django project and the efficiency gains associated with re-use (as opposed to reinventing the wheel).

它归结为Django项目的目标以及与重复使用相关的效率提升(而不是重新发明轮子)。

The stated goal for Django is to offer a web application framework that enables quick development and minimal code. The original tagline was a "web application framework for perfectionists with deadlines".

Django的既定目标是提供一个支持快速开发和最少代码的Web应用程序框架。原始标语是“具有最后期限的完美主义者的Web应用程序框架”。

That goal can be accomplished with a simple single-threaded web server that simply facilitates development and testing.

这个目标可以通过一个简单的单线程Web服务器来完成,它简单地促进了开发和测试。

The goal of Apache httpd, Nginx, IIS, etc. on the other hand is to offer exceptionally scalable and performant web servers. These applications are highly configurable as all applications differ and there's no one size fits all. They also require different expertise to design, implement and maintain.

另一方面,Apache httpd,Nginx,IIS等的目标是提供异常可扩展和高性能的Web服务器。这些应用程序具有高度可配置性,因为所有应用程序都有所不同,并且没有一种适合所有应他们还需要不同的专业知识来设计,实施和维护。

So it makes a lot of sense that with limited resources (developer time), the Django team chose to focus on the web-app framework, and leave the production-ready web server to another project.

因此,在资源有限(开发时间)的情况下,Django团队选择专注于Web应用程序框架,并将生产就绪的Web服务器留给另一个项目,这很有意义。

#2


7  

My understanding is that the folks at Django are not specialized in the server business and they never intended their server code to produce anything other than a way to develop and test on one's local machine without a lot of traffic. Per their own documentation

我的理解是,Django的人并不专注于服务器业务,他们从不打算让他们的服务器代码生成任何东西,除了在没有大量流量的情况下在一台本地机器上开发和测试。根据自己的文档

Now’s a good time to note: don’t use this server in anything resembling a production environment. It’s intended only for use while developing. (We’re in the business of making Web frameworks, not Web servers.)

现在是时候注意了:不要在类似生产环境的任何地方使用这个服务器。它仅用于开发时使用。 (我们的业务是制作Web框架,而不是Web服务器。)

#3


2  

It is not something specific to Django, that is the case for all modern web frameworks that I know, they all have this very simple built-in web server that we use only for development purposes, and the reason is obvious, it does not make any sense to reinvent the wheel since we already have very powerful web servers.

它不是特定于Django的东西,我所知道的所有现代Web框架都是如此,它们都有这个非常简单的内置Web服务器,我们仅用于开发目的,原因很明显,它没有因为我们已经拥有非常强大的Web服务器,所以重新发明轮子的任何意义。

Another important thing is that you can use one web server for one or more web applications that might be developed using different programming languages and web frameworks.

另一个重要的事情是,您可以将一个Web服务器用于可能使用不同编程语言和Web框架开发的一个或多个Web应用程序。


推荐阅读
author-avatar
吉尔伽美什2702933250
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有