简体   繁体   English

与REST Django的连接被拒绝

[英]Connection refused to REST Django

I have a problem with access to my REST Django data. 我在访问REST Django数据时遇到问题。 As u already understand, I have a Django app whith standart REST localhost with my data. 如您所知,我有一个带有我的数据的标准应用REST localhost的Django应用。 My another application, which i made in ReactJS, got Json file with data using axios throught standart GET ajax request. 我的另一个应用程序是我在ReactJS中创建的,它使用axios通过标准GET ajax请求获取了带有数据的Json文件。 Now i wanna to connect to my React app from another computer at the same network and it's go easily using http://ip4:3000 . 现在我想从同一网络上的另一台计算机连接到我的React应用程序,并且可以使用http://ip4:3000轻松进行。 But in that way i can't get data from REST page which i have on my localhost:8000 . 但是以这种方式,我无法从localhost:8000上的REST页面获取数据。 I try to get data from terminal in the same way using ip + localhostport , but i always got an error : 我尝试使用ip + localhostport以相同的方式从终端获取数据,但是我总是遇到错误:

curl: (7) Failed to connect to 106.120.89.142 port 8000: Connection refused curl:(7)无法连接到106.120.89.142端口8000:连接被拒绝

I can't do it using browser to, someone know solution for that? 我无法使用浏览器来做到这一点,有人知道解决方案吗?

You can start a django development server with 您可以使用以下命令启动django开发服务器

./manage.py runserver 0.0.0.0:8000

this will open your port and make django app to be visible from outside world. 这将打开您的端口,并使django应用在外部世界中可见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM