2
votes

I've been trying to get MOD_WSGI working on Apache via XAMPP on my Mac OS X Snow Leopard all day today without any success. I've followed all the instructions, searched the internet for solutions, etc but no luck so far. Below are my exact steps and details. When I run localhost all I get is a white screen. When I remove "LoadModule wsgi_module modules/mod_wsgi.so" from httpd.conf localhost runs as expected.

  1. Downloaded and installed Xcode.
  2. XAMPP is already installed and working.
  3. I Don't need to install Python as OS X already has Python 2.6 in 64-bit mode.
  4. Download and unpack mod_wsgi-2.6.tar.gz to desktop.
  5. Terminal "./configure --with-apxs=/Applications/XAMPP/xamppfiles/bin/apxs --with-python=/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6" (no errors)
  6. Terminal "make" (message "make: Nothing to be done for `all'.")
  7. Terminal "sudo make install" (no errors)
  8. Add to XAMPP's httpd.conf file:

LoadModule wsgi_module modules/mod_wsgi.so
AddType text/html .py
WSGIScriptAlias /app-sample "/Applications/xampp/xamppfiles/htdocs/app-sample/main.py"

<Directory "/Applications/xampp/xamppfiles/htdocs/app-sample">  
Order deny,allow  
Allow from all  
</Directory>  

  1. Restart Apache via XAMPP
1
Have you checked the apache log files? What do they say?lemonad
I am trying the same thing but I get an error on Step 5. : cannot open /Applications/xampp/xamppfiles/build/config_vars.mk: No such file or directory at /Applications/XAMPP/xamppfiles/bin/apxs line 218. Any idea how this can be corrected?user201788
Nevermind. I was using default xampp. I need to be using dev package of xampp. :)user201788

1 Answers

3
votes

First off, run 'make distclean' and then redo configure/make/make install for mod_wsgi. Where you have 'Terminal "make" (message "make: Nothing to be done for `all'.")' indicates there were prior build results in directory and nothing got built for that execution of make.

Next, use '.wsgi' extension instead of '.py' to ensure that you don't have a conflict with an existing definition saying that '.py' files should be executed as CGI scripts. This is one common reason for blank responses. The Apache error logs should give you clues as to this being the problem.

Also, what does your sample application do? Have you tried with a simple hello world program as per the documentation on the mod_wsgi site rather than jump to using your own program. If using your own program only, then you may possibly be causing Apache processes to crash due to some shared library conflict between Apache and Python modules being used, something else that will cause blank responses. Again, carefully check the Apache error logs for information logged at time request is made.

Finally your program could just be buggy and have bad syntax in returned HTML response causing it to not be displayed. Ask the browser to show the source for the page returned by the request and make sure it isn't malformed HTML.