I have a mac running Lion, and a D-link router DIR-601. I want to run my django development server as a public website for testing. I set up port forwarding to my computers local ip address, through port 8000. Then i entered the ip address of my router (obtained by typing my ip address in a browser) followed by :8000. Nothing. Can any one assist or point me to a tutorial for accomplishing this?
Asked
Active
Viewed 1,204 times
1
-
From the docs: [DO NOT USE THIS SERVER IN A PRODUCTION SETTING](https://docs.djangoproject.com/en/dev/ref/django-admin/#runserver-port-or-address-port) – Alasdair Jun 16 '13 at 16:40
-
thank you I accept the risks. – user2104778 Jun 16 '13 at 16:41
-
Does this answer your question? [How to make Django's devserver public ? Is it generally possible?](https://stackoverflow.com/questions/3328926/how-to-make-djangos-devserver-public-is-it-generally-possible) – alexdlaird May 07 '20 at 14:11
1 Answers
5
Try:
python manage.py runserver 0.0.0.0:8000
Because runserver
will bind to address 127.0.0.1 by default, which is not accessible by other computers.
And don't forget to change settings.py. You have to configure also ALLOWED_HOSTS. For example: ALLOWED_HOSTS = ['*']
-
Awesome it worked when I replaced 0.0.0.0 with my local ip address, and set up a virtual server in the dlink router. But your comment helped me get there. – user2104778 Jun 16 '13 at 20:03
-
Out of curiousity - what are the risks in running a development server? I have the whole site password protected. – user2104778 Jun 17 '13 at 03:46