问题
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