django is very slow on my machine

I have had the same problem in the past. It can be solved by removing the following line from your hosts file.

::1         localhost

Once that's gone you should be able to use localhost again, quickly.


None of these posts helped me. In my specific case, Justin Carmony gave me the answer.

Problem

I was mapping [hostname].local to 127.0.0.1 in my /etc/hosts file for easy development purposes and dns requests were taking 5 seconds at to resolve. Sometimes they would resolve quickly, other times they wouldn't.

Solution

Apple is using .local to do some bonjour magic on newer Snow Leopard builds (I think i started noticing it after updating to 10.6.8) and Mac OS X Lion. If you change your dev hostname to start with local instead of end with local you should be all set. Additionally, you can pretty much use any TLD besides local and it will work without conflict.

Example

test.local could become:

  • local.test.com
  • test.dev
  • test.[anything but local]

and your hosts file entry would read:

local.test.com  127.0.0.1

Note: This solution has the added benefit of being a subdomain of [hostname].com which makes it easier to specify an app domain name for Facebook APIs, etc.

Might also want to run dscacheutil -flushcache in the terminal for good measure after you update /etc/hosts


Firefox has a problem browsing to localhost on some Windows machines. You can solve it by switching off ipv6, which isn't really recommended. Using 127.0.0.1 directly is another way round the problem.

Tags:

Python

Dns

Django