Django遠端存取,django外網訪問

來源:互聯網
上載者:User

Django遠端存取,django外網訪問

http://blog.csdn.net/pipisorry/article/details/44755423

預設方法啟動django

terminal中對應目錄輸入
 python manage.py runserver
這時啟動的服務只能在本機訪問,這是因為服務只向本機(127.0.0.1:8000)提供,所以區域網路的其他機器不能訪問。在另一台機器上訪問django開放的介面會出現Page not found (404)錯誤。
完成後在本機瀏覽器中輸入127.0.0.1:8000/music就可以訪問自己的網站了

讓網路上的其他電腦能夠訪問djang的服務
需要更改啟動django的命令 manage.py runserver 0.0.0.0:8000其它電腦中訪問的時候需要指明是http訪問,格式如下:http://192.168.31.213:8000/music在區域網路內測試通過from:http://blog.csdn.net/pipisorry/article/details/44755423

ref:[The Django Book-視圖和URL配置]

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.