使用Apache2在Redhat4上设置python django的步骤

时间:2012-05-07 22:44:11

标签: django apache mod-wsgi redhat

安装python django在Redhat4系统上使用Apache2所需的所有依赖项有哪些步骤?

1 个答案:

答案 0 :(得分:0)

检查是否有安装其他模块所需的Apache apxs module(sudo find / -name“apxs”)。

如果不存在apxs模块,那么:

sudo yum install httpd-devel

对于python的django模块,你需要安装python开发包及其依赖项 - 在我的例子中我运行了这两个安装命令:

sudo yum install gcc
sudo yum install python-devel

安装和配置dgango与apache交谈有点复杂。您需要安装mod_wsgi python模块并编辑/配置apache配置文件和wsgi.py文件(read this)。

wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
tar xvfz mod_wsgi-3.3.tar.gz
cd mod_wsgi-3.3
./configure 

在apache配置文件的“LoadModule”部分添加此行(即。这些名称如下:www.vhost.confhttpd.conf等)

LoadModule wsgi_module modules/mod_wsgi.so

重新启动apache,以便识别您的新更改:

/etc/init.d/sudo service httpd stop
/etc/init.d/sudo service httpd start

Redhat Docs for installing Apache modules