• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 137
  • Last Modified:

Make django server IP public.

I have a window machine with static IP. I have a django server installed on it. How to make a server run on its static IP so that the server is accessible from everywhere.
0
Vivek Agarwal
Asked:
Vivek Agarwal
  • 2
3 Solutions
 
Pallavi GodseSr. Digital Marketing ExecutiveCommented:
You will need to run the development server such that it listens on the interface to your network.

For example,
python manage.py runserver 0.0.0.0:8000

Open in new window

listens on every interface on port 8000.

It doesn't matter whether you access the webserver with the IP or the hostname. I guess you are still in your own LAN.

If you really want to access the server from outside, you also have to configure your router to forward port e.g. 8000 to your server.

Check your firewall on your server whether incoming connections to the port in use are allowed!

Assuming you can access your Apache server from the outside successfully, you can also try this:

    Stop the Apache server, so that port 80 is free.
    Start the development server with
sudo python manage.py runserver 0.0.0.0:80

Open in new window

0
 
David Johnson, CD, MVPOwnerCommented:
you also have to forward port 8000 TCP to the machine's ip address.  If you have a dynamic WAN ip address use a service like dyndns.com so you have a NAME and not have to enter the external ip address or worry if it changes.
0
 
Cyclops3590Commented:
you also need to add the IP or fqdn to the allowed_hosts list depending on how you're accessing the app otherwise you'll just get a 400 bad request error
0
 
Cyclops3590Commented:
pallavi got most of the answer while I believe david and cyclops added a couple more points of interest that could cause issues when exposing the django server to the internet
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now