Error: That IP address can't be assigned-to in Django?

17,794

Solution 1

You are missing two lines of code in network configuration file. Edit the file as a root user with any text editor:

sudo gedit /etc/network/interfaces

Add these two lines:

    auto lo

    iface lo inet loopback

Restart the network using the following command:

sudo /etc/init.d/networking restart

Now, the localserver will work fine.

Solution 2

That's not related to Django but to your network configuraton. The very basic loopback interface is not working properly. If you want to learn more about networking and this layer.

Your problem is that your host cannot ping to itself, and so Django gets an error when getting the network address. That's in django/core/management/commands/runserver.py and is returned when it gets the system error 99 (EADDRNOTAVAIL).

Your network configuration at /etc/network/interfaces should have this piece at the beginning:

# The loopback network interface

auto lo
iface lo inet loopback

Check Debian documentation for full network configuration.

Share:
17,794

Related videos on Youtube

Joyfulgrind
Author by

Joyfulgrind

Updated on September 15, 2022

Comments

  • Joyfulgrind
    Joyfulgrind over 1 year

    I am running Debian 6 stable and I am trying to run Django locally using ./manage.py runserver command. This is what I get:

    Validating models...
    
    0 errors found
    Django version 1.4.1, using settings 'genelaytics.settings'
    Development server is running at http://127.0.0.1:8000/
    Quit the server with CONTROL-C.
    Error: That IP address can't be assigned-to.
    

    I tried creating a new django project, still get the same error. What's the problem? I just fresh re-installed Debian yesterday because of this problem. This problem hasn't gone away. How can I fix it?

    • Rustem
      Rustem over 11 years
      This is public ip trouble, just try to use python manage.py runserver 0.0.0.0:8000.
  • Bryce
    Bryce almost 11 years
    In my case, this happens on WiFi only, but not when the computer is hooked to a wired Ethernet. At those points I can use "python manage.py runserver 0.0.0.0:8000" and it all works out ok.
  • Mohini
    Mohini over 8 years
    already this 2 lines are there but still I am getting error. What to do?
  • Mohini
    Mohini over 8 years
    Already this 2 lines are there but still I am getting error. What to do?
  • khue bui
    khue bui over 7 years