mac安装apache的mod_wsgi模块

第一次用pip安装 ,最终不能使用,原因是系统自带的apache,python和新安装的冲突,

所以需要安装时需要指定apache,python路径

所以用make makeinstall方式

参考链接 :

http://www.jb51.net/article/76934.htm

1 下载 

mod_wsgi

进行下载目录

./configure --with-apxs=/Users/levin/dev/apache2.2.27/bin/apxs --with-python=/usr/bin/python
make
make install
以上路径分别对应本机相应安装路径
打开 apache配置文件httpd.conf
添加
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /hello.wsgi /Applications/XAMPP/xamppfiles/htdocs/hello.wsgi  
在xampp的htdocs目录下建文件hello.wsgi
内容:

#hello.wsgi
def application(environ, start_response):
status = "200 OK"
response_headers = [('Content-type', 'text/plain')]
output = "hello world!"
start_response(status, response_headers)
return [output]

浏览器里测试localhost/hello.wsgi

 

posted @ 2017-03-23 22:20  xqnq2007  阅读(944)  评论(0编辑  收藏  举报