Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ArtOfWarfare

macrumors G3
Original poster
Nov 26, 2007
9,553
6,053
Resolution appended to end of post

I have MAMP running from:
http://www.mamp.info/en/

I need to add Django to it. I followed the first two sections of this Django tutorial to get a bit familiarized with Django:
https://docs.djangoproject.com/en/1.6/intro/tutorial01/

So I had the Admin app working with the Polls model using the MySQL database from MAMP, but rather than the Apache that came with MAMP, I was using whatever Django includes for development (whatever it is that starts up by default when you use python manage.py runserver).

But then I decided that I wanted to have Django on the copy of Apache that came with MAMP.

So I took a look at this page to find out how to do that:
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/modwsgi/

MAMP comes with Apache 2.2.26, so I think it requires the modifications mentioned at the start of the page (which it says are necessary if you're running below Apache 2.4).

So here's what I added to httpd.conf:

Code:
WSGIScriptAlias / /Users/Taylor/Dropbox/Programming/Rantt/server/wsgi.py
WSGIPythonPath /Users/Taylor/Dropbox/Programming/Rantt

<Directory /Users/Taylor/Dropbox/Programming/Rantt/server>
    <Files wsgi.py>
        Order deny,allow
        Allow from all
    </Files>
</Directory>

I inserted that at line 192, to give the exact position within the httpd.conf, if that's important.

Then I restarted MAMP and went to

http://localhost/admin

And it gave me a HTTP 500 page instead of the polls admin page that I had seen when I was using Django's development server and navigated to http://localhost:8000/admin

To verify that the httpd.conf file was being read, I modified the ServerAdmin variable to have a different email address, and the HTTP 500 page changed to have that new email address.

I'm quite inexperienced with this kind of thing... does anyone have any pointers for either what it sounds like I've done wrong, or where I should look?

Oh, and before I forget to mention it, http://localhost still loads the index.html page from /Applications/MAMP/htdocs, so I know that Apache is starting up at least.

Resolved

I found a directory called "Logs" in MAMP and took a look. In there, I saw that it was trying, but failing, to load Django, because it wasn't able to find the package. So I changed the WSGIPythonPath line in httpd.conf to include ":/Library/Python/2.7/site-packages" at the end of it. Now stuff is appearing, but it's not styling it properly. I suspect I need to tweak some paths somewhere to include static documents or something.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.