1
這可能是一個非常基本的問題。我ssh到我的虛擬Ubuntu的服務器,並開始一個Django的web服務器上的本地主機上運行:從外部訪問本地主機?
Downloading/unpacking django
Downloading Django-1.9.5-py2.py3-none-any.whl (6.6MB): 6.6MB downloaded
Installing collected packages: django
Successfully installed django
Cleaning up...
Performing system checks...
System check identified no issues (0 silenced).
You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.
April 13, 2016 - 14:16:19
Django version 1.9.5, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Ubuntu的服務器有一個靜態IP [x.xxx.xxx.xxx]所以從另一個網絡上的另一臺機器我嘗試訪問在瀏覽器上面的網站使用靜態IP地址:
x.xxx.xxx.xxx:8000
,但我得到:
This site can’t be reached
x.xxx.xxx.xxx refused to connect.
ERR_CONNECTION_REFUSED
所以我認爲我無法訪問的網站是這樣,這是隻有在主機它可用即使主機有外部/靜態IP地址?
編輯:
答案也是: https://docs.djangoproject.com/en/1.9/intro/tutorial01/#the-development-server
python manage.py runserver 0.0.0.0:8000
你的意思是0.0.0.0:8000?請參閱https://docs.djangoproject.com/en/1.9/intro/tutorial01/#the-development-server – u123
對不起,錯了。 –