您的位置:首页 > 运维架构 > Linux

Django 安装 在CentOS

2015-06-15 15:34 357 查看
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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: