所以我有一个新的mac,我试图让它用mod_python,mod_wsgi和django运行apache。我有一个测试test.py,它只包含:
#!/usr/bin/python
print "Content-type: text/html"
print
print "<html><head>"
print ""
print "</head><body>"
print "Test Page"
print "</body></html>"
我刚刚下载了xcode4,使用macports通过这些网站上提供的步骤安装apache,php5和mod_wsgi:
http://www.phpied.com/installing-php-and-apache-on-mac-osx-that-was-pretty-easy/
http://heisel.org/blog/2009/09/25/mod-wsgi-mac/
由于某种原因,mod_python不起作用所以我从svn下载了最新的源代码并执行标准./configure --with-apxs=/opt/local/apache2/bin/apxs
make
sudo make install
然后使用LoadModule blah modules / blah.so
配置httpd.conf当我用
启动apache时sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start
并在我的浏览器中导航到test.py,我看到整个文件是纯文本的,我知道这是不对的。 我在httpd.conf中启用了python调试,当我再次导航到test.py时看到了这个突然出现:
MOD_PYTHON ERROR
ProcessId: 93626
Interpreter: 'dfelsmanmpx6.blah.blah'
ServerName: 'dfelsmanmpx6.blah.blah'
DocumentRoot: '/Users/me/folder/workspace/'
URI: '/test.py'
Location: None
Directory: '/'
Filename: '/Users/me/folder/workspace/test.py'
PathInfo: ''
Phase: 'PythonHandler'
Handler: 'text'
Traceback (most recent call last):
File "/Library/Python/2.6/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "/Library/Python/2.6/site-packages/mod_python/importer.py", line 1202, in _process_target
module = import_module(module_name, path=path)
File "/Library/Python/2.6/site-packages/mod_python/importer.py", line 304, in import_module
return __import__(module_name, {}, {}, ['*'])
ImportError: No module named text
任何人都知道有什么问题或者知道如何在带有xcode 4的mac上执行此操作的教程(是的,在我的研究中实际上是相关的,因为xcode 4取消了一些架构支持,从而使一些模块过时了) ?
答案 0 :(得分:0)
正如@ ignatio-vazquez-abrams所指出的那样,mod_python已被弃用,但如果您已经开始使用它,则可能需要查看Homebrew。安装Homebrew后,您可以在终端中运行brew install mod_python
。安装之后,您将看到有关将已编译的mod添加到Apache配置的注释(以及弃用警告。)