linux下安装mod_python和django笔记

安装 mod_python

1、到 www.modpython.org

 下载源码包,解压得到目录,进入该目录,执行:

 

 ./configure --with-apxs=/opt/apache/bin/apxs --with-python=/usr/bin/python2.7

 make

 make install
 

完毕之后,mod_python 会在 /opt/apache/modules 中添加 mod_python.so 库文件,并且在 /opt/python/2.7/lib/python2.7/site-packages 中添加 mod_python 包。

如果编译程序没有检测到 apache 和 python,会报错退出。

 

 

如果你将mod_python编译成DSO,那么你需要通过在Apache的配置文件(通常称为httpd.conf 或者 apache.conf)里面加入如下一行,来载入模块:

    LoadModule python_module modules/mod_python.so

例子

<Location "/blog">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE zlblog.settings
PythonInterpreter zlblog
PythonDebug On
</Location>

 留给静态文件一个缝隙

<Location "/blog/(images|css|js)">
SetHandler none
</Location>

 

------------------

注意这里有一个bug

connobject.c: In function '_conn_read':

connobject.c:142: error: request for member 'next' in something not a structure

or union

apxs:Error: Command failed with rc=65536

.

make[1]: *** [mod_python.so] Error 1

make[1]: Leaving directory `/usr/src/rpm/BUILD/mod_python-3.3.1/src'

make: *** [do_dso] Error 2

需修改mod_python-3.3.1/src/connobject.c中

!(b == APR_BRIGADE_SENTINEL(b)

为

!(b == APR_BRIGADE_SENTINEL(bb)

--------------

 

 

 

2.安装django

   下载django包后解压,运行

python setup.py install
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值