How to make Django site accessible via IP address ? (deployed with Helicon Zoo and IIS)

592 Views Asked by At

I deploy Django with Helicon Zoo and IIS

I have my Django project runs on localhost:xxxx My IIS goes live, the default site can be accessed by address However my Django project can't be accessed by IP:xxxx. It returns : Bad Request - Invalid Hostname HTTP Error 400. The request hostname is invalid.

How to make my Django site accessible by IP address? Or how to point the IP address directly to my Django project?

1

There are 1 best solutions below

0
On

For the site to work on all addresses you need to:

  1. run IIS manager,
  2. choose your site with Django project,
  3. click 'Binding...' in right sidebar,
  4. select (or create new) bindingand make sure the IP address field says 'All Unassigned' like on this pic:

edit of IIS site binding

It is also necessary to make sure that settings.py for your project has ALLOWED_HOSTS record and it contains the domain name that is used to access your site. Here's the link to the Django docs: https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts