我制作的mod_wsgi如下
$./configure
--with-python=/Library/Frameworks/Python.framework/Versions/2.7/bin/python
--with-apxs=/usr/local/apache2/bin/apxs
checking Apache version... 2.0.63
configure: creating ./config.status
config.status: creating Makefile
$sudo make $sudo make install
然后我将文件从
/usr/local/apache2/modules/mod_wsgi.so
复制到 /Applications/MAMP/Library/modules/mod_wsgi
。
然后我在
httpd.conf
中添加了以下内容:
LoadModule wsgi_module modules/mod_wsgi.so
最后,我为 Apache 加注星标,但出现错误。
$ sudo /Applications/MAMP/Library/bin/apachectl start
Syntax error on line 287 of /Applications/MAMP/conf/apache/httpd.conf: Cannot load /Applications/MAMP/Library/modules/mod_wsgi.so into server: cannot create object file image or add library
第 1 步:确保您的 MAMP 版本为版本 2,因为它包含通用二进制安装程序(32 位和 64 位)
第2步:修改您的Make文件并删除其他编译器版本,类似于:
CPPFLAGS = -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DNDEBUG
CFLAGS = -Wc,"-arch i386" -Wc,"-arch x86_64" -Wc
LDFLAGS = -arch i386 -arch x86_64 -F/Library/Frameworks -framework Python -u _PyMac_Error
LDLIBS = -ldl -framework CoreFoundation
第3步:在httpd.conf中:LoadModule wsgi_module module/mod_wsgi.so