[Fixed]-"Error: That IP address can't be assigned-to" when running app

43👍

Use:

python manage.py runserver 0:8000

5👍

You should check with your IP, as mine was changed and was getting the same error

3👍

It is equivalent to error code #99 in c language errors list, It’s described by this term:

Cannot assign requested address

It is not a permission problem, because permission’s error code is different so I think it’s because you have not that IP address set on your computer. When you try to run server on an specified IP address, you should have it set on one of your network interfaces.

Simply the IP address you’re trying to run server on it is not your current IP address.

3👍

If you are using Amazon EC2 or Lightsail use private and public IPs like this:

Public for browser: <your-public-ip>:8000

Private for command line: python manage.py runserver <your-PRIVATE-ip>:8000

1👍

  1. run ipconfig in your cmd and copy ipv4 address.

  2. go to settings file of the project and the IP as a string in allowed host.

  3. now run server using command python manage.py runserver 0:8080

1👍

Check your Network IP address in CMD or Terminal using ipconfig for windows and ifconfig for linux
and change IP accordingly for allowed hosts in Settings.py

Note: Your IP address may be changed due to service provider added more subnets to it so you just have to replace old by new IP

0👍

Just add ‘localhost’ to ALLOWED_HOSTS in settings.py. Then, python manage.py runserver localhost:8000. Run localhost:8000 in your url and it shall work.

0👍

I was receiving the same error.

I install Django tenant and its schema module by the below command. And error resolved.

  1. pip install django-tenants
  2. pip install django-tenant-schemas

NOTE:- it could be pip3 in your system

👤Avi

Leave a comment