Make Django development server a public website

纵饮孤独 提交于 2019-12-11 13:09:54

问题


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?


回答1:


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 = ['*']



来源:https://stackoverflow.com/questions/17135413/make-django-development-server-a-public-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!