So i've got a new mac and i am looking to get it to operate apache with mod_python, mod_wsgi, and django. I've got a test that merely consists of: #!/usr/bin/python print "Content-type: text/html" print print "<html><head>" print "" print "</head><body>" print "Test Page" print "</body></html>"

I have just downloaded xcode4, used macports to set up apache, php5, and mod_wsgi through the step provided on these websites: for whatever reason mod_python wouldn't work and so i downloaded the most recent source code in the svn and doing the conventional ./configure --with-apxs=/opt/local/apache2/bin/apxs make sudo make install

after which setting up httpd.conf using the LoadModule blah modules/

after i cranked up apache with

sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start

and sailed to during my browser and that i saw the whole file in plain text with i understand that is not right. I switched on python debug in httpd.conf and saw this after i sailed to again this sprang out:


ProcessId:      93626
Interpreter:    'dfelsmanmpx6.blah.blah'

ServerName:     'dfelsmanmpx6.blah.blah'
DocumentRoot:   '/Users/me/folder/workspace/'

URI:            '/'
Location:       None
Directory:      '/'
Filename:       '/Users/me/folder/workspace/'
PathInfo:       ''

Phase:          'PythonHandler'
Handler:        'text'

Traceback (most recent call last):

  File "/Library/Python/2.6/site-packages/mod_python/", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/Library/Python/2.6/site-packages/mod_python/", line 1202, in _process_target
    module = import_module(module_name, path=path)

  File "/Library/Python/2.6/site-packages/mod_python/", line 304, in import_module
    return __import__(module_name, {}, {}, ['*'])

ImportError: No module named text

anybody know what's wrong or are conscious of a tutorial regarding how to do that on the mac with xcode 4(yes, during my research that's really relevant since xcode 4 did away with a few architecture support and therefore made some modules outdated)?

As @ignatio-vazquez-abrams noted, mod_python is deprecated, but when you are set on utilizing it, you might want to take a look at Homebrew. Once Homebrew is installed, you are able to run brew install mod_python in Terminal. After installation, you will see an email about adding the put together mod for your Apache config (in addition to a deprecation warning.)