Django 安装 在CentOS

1. 编译python   
bogon:kuoxin$ ./configure --prefix=/share/python3 --enable-shared
bogon:kuoxin$ make
bogon:kuoxin$ make install


2. 编译wsgi bogon:kuoxin$ ./configure --with-python=/share/python3/bin/python3

如果报如下错误: share/python3/bin/python3: error while loading shared libraries: libpython3.3m.so.1.0: cannot open shared object file: No such file or directory 表示系统不知道xxx.so放在哪个目录下,这时候就要在/etc/ld.so.conf中加入xxx.so所在的目录。一般而言,有很多的so会存放在/usr/local/lib这个目录底下,去这个目录底下找,果然发现自己所需要的.so文件。所以,在/etc/ld.so.conf中加入/share/python3/lib/这一行,保存之后,再运行:/sbin/ldconfig –v更新一下配置即可。 bogon:kuoxin$ make 如果出现错误需要修改Makefile文件。 bogon:kuoxin$ vi Makefile 修改如下: LDFLAGS = -L/share/python3/lib -L/share/python3/lib/python3.3/config LDLIBS = -lpython3.3m -lpthread -ldl -lutil -lm bogon:kuoxin$ make install
3. 配置httpd.conf文件

    LoadModule wsgi_module modules/mod_wsgi.so
    WSGIScriptAlias /  '/share/htdocs/django/proj/wsgi/django.wsgi'

    如果还有别的php等网站共享httpd,可添加虚拟路径
        Alias /rockmongo "/share/htdocs/rockmongo/"
        <Directory "/share/htdocs/rockmongo/">
             Order allow,deny
            Allow from all
        </Directory>
 
posted @ 2015-06-15 15:34  kuoxinxin  阅读(306)  评论(0编辑  收藏  举报