Serve Python through the Leopard Firewall
I’m working on a few Django projects now any I’m learning some of the tricks the hard way. Hopefully I can save you some of that pain.
I was recently having some trouble getting any of the browsers in my Windows XP under Parallels to see my local development server running on my Leopard Mac. It would load all of my Apache and Mongrel served apps fine, but it refused to connected to the Django server.
- The Django development server refuses all connections from any other machine.
- The Leopard Firewall refuses to allow any other machine to access your Python server.
- Parallels and VMWare Fusion operating systems run asif they are real machines on your local network.
So, to get all these things working together…
- Allow incoming connections for Python in the Leopard Firewall
- Force the Python Django development server to allow access to other people on your LAN
Allow incoming connections for Python in the Leopard Firewall
- Open your System Preferences
- Firewall Tab
- Select “Set access for specific services and applications”
- Click the + icon at the bottom left of the list
- ⇧⌘G — Go to folder “/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/”
- Select the Python app
- Click “Add”
- Find Python in the list (just above Quicktime Player for me)
- Change the dropdown on the right so show “Allow incoming connections”
Force the Python Django development server to allow access to other people on your LAN
- Simply always serve with the ip
python manage.py runserver 0.0.0.0:8000
- There is no step 2
Now you’re free to enjoy cross browser testing for your locally served Python Django webapps!