29

I am learning Django and have deployed apps on my iMac locally. I want to show the apps from external IPs over the internet. I did add an exception to the firewall for port 8000, and ran the python dev server over 8000. Able to access at localhost, but not over the net. However, when I tried XAMPP (Apache) over the same port 8000, I can access the site externally, despite needing to change the httpd-xampp.conf file. Is there a similar file for the python server? How can I access the dev server from external IP's?

Environment: Mac OSX 10.5.8, Python 2.5, Django 1.2.5

Thanks in advance!

tomato
  • 5,644
  • 13
  • 43
  • 48

1 Answers1

62
python manage.py runserver 0.0.0.0:8000

This will make it listen to any address. Quite useful when you want to develop over ssh from a machine that you cannot install stuff on.

Uku Loskit
  • 40,868
  • 9
  • 92
  • 93
  • What if port 8000 is in use, is there another port I can use to give me access? I tried port 8008 because someone suggested it is an alternative, but can't get access. – almost a beginner Jul 26 '16 at 10:50
  • 1
    You can use another port. For example 0.0.0.0:7000 and your server listens to 0.0.0.0:7000. BTW make sure to include your ip or '*' to your ALLOWED_HOSTS in your settings.py file. – GregC Mar 03 '18 at 17:55