简体   繁体   English

django:程序化连接被拒绝

[英]django: programmatic connection refused

I'm trying to test out this POST request that I've implemented on my django web server and I ran into quite the snag... 我正在尝试测试我在django Web服务器上实现的POST请求,但遇到了一些麻烦...

After running the server with: 使用以下命令运行服务器后:

python manage.py runserver python manage.py运行服务器

I figured that the quickest and dirtiest way to do test out the POST is through telnet. 我认为测试POST最快,最脏的方法是通过telnet。

telnet localhost 8000 telnet本地主机8000

gave me 给我

Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused

Then I realized that if the connection is refused, then I won't even be able to do my GET requests through my client-side. 然后我意识到,如果连接被拒绝,那么我什至无法通过客户端执行GET请求。 When I try to access the page through my web browser (Chrome), I GET the proper json response, and even the POST uri goes through (though with no data...) 当我尝试通过网络浏览器(Chrome)访问该页面时,我得到了正确的json响应,甚至POST uri都通过了(尽管没有数据...)

I then tried a programmatic approach by establishing a connection with Python's urllib2 but even that gave me a connection refused exception. 然后,我尝试通过与Python的urllib2建立连接来尝试编程方式,但是即使这样,我也获得了连接被拒绝的异常。

I'm a complete django noob so I feel like I'm just forgetting something basic here... I will provide more server-specifications if you need. 我是一个完整的django noob,所以我觉得我只是在这里忘记了一些基本的知识...如果您需要,我将提供更多服务器规范。

Thanks 谢谢

I don't know if I understand you correctly but I think what you are looking for is postman , a chrome plugin to do the POST thing. 我不知道我是否正确理解您的意思,但我认为您正在寻找的是邮递员 ,即执行POST任务的Chrome插件。

在此处输入图片说明

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

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