开发者

Why can’t Internet Explorer access my Django Development Server that’s accessible externally (i.e. not on localhost?)

开发者 https://www.devze.com 2023-03-06 18:53 出处:网络
I\'ve been tasked by 开发者_JAVA百科my programming teacher to learn Django. However, I need to code on a command line linux box and therefore cannot access the web page from said linux box.

I've been tasked by 开发者_JAVA百科my programming teacher to learn Django. However, I need to code on a command line linux box and therefore cannot access the web page from said linux box.

To test, I need to host it on the local IP of the computer rather than localhost. I’m currently running the Django development server using this command:

python manage.py runserver 0.0.0.0:8000

Firefox and Chrome can access the development server at the Linux box’s IP address, but Internet Explorer can’t.


Unfortunately (I am said teacher), I can't provide a linux host - only a linux server and a windows host to do development on.

He's actually running the web server correctly, with the command provided by Paul. But for some reason, it's only visible in Firefox/Chrome, IE just provides a generic "Webpage cannot be displayed"

But this problem can be solved by using the entire address: http:// isn't optional like it is in Chrome and Firefox.


When you run the development server, you can make it available on the local network by specifying the IP address 0.0.0.0 for it, like this:

python manage.py runserver 0.0.0.0:8000

If your Linux box’s local IP address is e.g. 192.168.1.37, you’d access the development server at:

http://192.168.1.37:8000


Setup nginx to listen on a public port and proxy all of the requests to the django runserver.


You need to specify the IP clearly in the command line like this in order to let other clients to access. You also have to enable the port 8000 in the firewall:

python manage.py runserver 192.168.1.37:8000
0

精彩评论

暂无评论...
验证码 换一张
取 消