简体   繁体   English

Django:使用Apache和FastCGI部署应用程序

[英]Django: Deploying application using Apache and FastCGI

I've been following the book "The Definitive guide to Django" to create a web application. 我一直在遵循《 Django权威指南》这本书来创建一个Web应用程序。 So far so good and soon, I'll be deploying the application on production. 到目前为止,到目前为止,我将在生产环境中部署该应用程序。 I am targeting the usage of Apache + FastCGI specified on the book. 我的目标是书上指定的Apache + FastCGI的用法。 I am able to follow the initial setup indicated in the book. 我能够按照书中指示的初始设置进行操作。 (ie install Apache, install mod_fastcgi and edit httpd.conf). (即安装Apache,安装mod_fastcgi并编辑httpd.conf)。 The next step indicated is "Specifying the Location of the FastCGI server". 指示的下一步是“指定FastCGI服务器的位置”。 There are 2 steps which are (1)Use the FastCGIExternalServer directive to specify the location of your FastCGI server and (2)Use mod_rewrite to point URLs at FastCGI as appropriate. 有2个步骤,分别是(1)使用FastCGIExternalServer指令指定FastCGI服务器的位置,以及(2)使用mod_rewrite适当地将URL指向FastCGI。

This is where I got lost. 这是我迷路的地方。 I don't know if I will just add the following lines again to httpd.conf: 我不知道是否仅将以下几行再次添加到httpd.conf中:

# Connect to FastCGI via a socket/named pipe:
FastCGIExternalServer /home/user/public_html/mysite.fcgi -socket /home/user/mysite.sock
# Connect to FastCGI via a TCP host/port:
FastCGIExternalServer /home/user/public_html/mysite.fcgi -host 127.0.0.1:3033

If not, how should I proceed on this? 如果没有,我应该如何进行呢? Hoping to hear any ideas. 希望能听到任何想法。 Thank you very much in advance! 提前非常感谢您!

I am not familiar with FastCGI myself (I have used Apache's mod_wsgi and gunicorn in the past, and will probably use gunicorn in the future) but it looks like you only need one of those lines. 我本人对FastCGI并不熟悉(我过去使用过Apache的mod_wsgi和gunicorn,将来可能会使用gunicorn),但看起来您只需要其中一行即可。 Preferably the top one using the socket. 最好是顶部使用插座。

Which file you add it to exactly depends on your specific Linux distribution. 您将其添加到哪个文件完全取决于您的特定Linux发行版。 I would recommend not using your book for advice on how to serve django, because online tutorials specific to a linux distribution (for instance, this Linode help article on how to install django on Ubuntu 10.04 with mod_wsgi) will be more up-to-date and more specific. 我不建议您使用本书来提供有关如何服务django的建议,因为特定于linux发行版的在线教程(例如, 有关如何使用mod_wsgi 在Ubuntu 10.04上安装django的Linode帮助文章 )将是最新的更具体。 Only try to make sense of a potentially out-of-date book's instructions if you are an experienced system administrator. 如果您是经验丰富的系统管理员,请仅尝试理解可能过时的书中的说明。

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

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