11

I am getting this error intermittently but when it happens my automated integration testing using Django's LiveServerTestCase comes to a screeching halt throwing the following error:

WSGIServerException: [Errno 8] nodename nor servname provided, or not known

The failure comes as soon as the main test class is instantiated from any given test (this happens after the in-memory db is created and my fixtures are loaded).

My setup is as follows:

  • Mac OSX Snow leopard
  • Django 1.4.1
  • Virtual environment (housing all Python libraries)
  • sqlite (for testing) MySQL/InnoDB for production
  • Local Git branches housing code

So far, this error only occurs while testing on our LAN at my office. At home, tests run just fine but then again tests run fine at my work for a time, hence the intermittent frustration.

In the vein of troubleshooting I have created a new virtualenv, removed all .pyc files system wide, reinstalled MySQL from source as well as all required libraries.

If anyone has come across this error and knows how to beat it, please share.

Thanks

1
  • What live server address are you using for testing?
    – nneonneo
    Aug 24, 2012 at 2:18

4 Answers 4

9

Sounds like it might be a network issue. Check that you have a consistent internet connection (e.g. by pinging an appropriate server continuously as you run the tests), and that your DNS server is consistently reporting results (e.g. not randomly dropping requests or timing out).

You could also try changing the live server address to a straight IP address (e.g. change localhost to 127.0.0.1), so that it doesn't have to perform an address lookup.

1
  • Thanks for pointing me in the right direction. The fault was all mine. I mistakenly deleted the last decimal from my localhost IP in my hosts file. Back up and running now. Thanks!
    – frozenpaw
    Aug 24, 2012 at 13:58
5

To me, turning WiFi on and off again helped on Max OS X Yosemite.

5

I solved this problem by changing this line in /etc/hosts:

# 127.0.0.1 localhost

to

127.0.0.1 localhost

I don't know why the line was commented out.

0

In my case I started the local Django server with:

./manage.py runserver silberpfeil.local:8000

and after a few seconds I got the error:

Error: [Errno 8] nodename nor servname provided, or not known

In the settings under "Share Points" I saw that Mac OS X somehow seems to have changed the computer name to silberpfeil-2.local

enter image description here

So I have to run this command now or change the hostname:

./manage.py runserver silberpfeil-2.local:8000

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.