为什么ip访问可以,但域失败?

2024-04-26 05:02:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我在具有公共IP的服务器上启动一个新的Django应用程序,然后使用命令运行它:

python manage.py runserver publicip:port

然后我发现当我用http://publicip:port访问它时,它工作得很好。 但是当我使用域名(解析为这个ip)访问它时,它失败了, 并给出打击误差:(https://dpaste.de/FIrk

^{pr2}$

有谁能给我一些建议来找出原因吗?太多了。在


Tags: djangopyhttps命令ip服务器应用程序http
2条回答

使用域名而不是IP运行runserver

python manage.py foobar.com:8000

记住你most definitely shouldn't use ^{} in production

DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests. (And that’s how it’s gonna stay. We’re in the business of making Web frameworks, not Web servers, so improving this server to be able to handle a production environment is outside the scope of Django.)

已经很长时间了,但是我想我应该把这个写下来给其他有同样问题的人。在

这是因为中国的域名不是BeiAn(备案),ISP阻止了对这台服务器的访问。在

相关问题 更多 >