[英]Cannot access my Django page hosted on AWS EC2 instance
I cannot access my Django app on an EC2 instance (host2) in my browser by typing its public DNS name with port number: ec2-public-dns-of-this-instance.compute-1.amazonaws.com:8000
我无法在浏览器中的 EC2 实例 (host2) 上访问我的 Django 应用程序,方法是输入其公共 DNS 名称和端口号: ec2-public-dns-of-this-instance.compute-1.amazonaws.com:8000
./manage.py runserver 0.0.0.0:8000
我以这种方式开始了我的 Django 项目: ./manage.py runserver 0.0.0.0:8000
ALLOWED_HOSTS
file which has these now: ALLOWED_HOSTS = ['*', '127.0.0.1', 'ec2-public-dns-of-this-instance.compute-1.amazonaws.com', '0.0.0.0', 'localhost']
我已将主机添加到我的ALLOWED_HOSTS
文件中,该文件现在具有以下内容: ALLOWED_HOSTS = ['*', '127.0.0.1', 'ec2-public-dns-of-this-instance.compute-1.amazonaws.com', '0.0.0.0', 'localhost']
curl localhost:8000
which returned me 200 and Django default HTML page when I'm ssh'ed into this instance.当我 ssh 进入这个实例时,我能够curl localhost:8000
返回 200 和 Django 默认 HTML 页面。curl ec2-public-dns-of-this-instance.compute-1.amazonaws.com:8000
which also returned me 200 and Django default HTML page when I'm ssh'ed into this instance. I was able to curl ec2-public-dns-of-this-instance.compute-1.amazonaws.com:8000
which also returned me 200 and Django default HTML page when I'm ssh'ed into this instance.Any ideas how to fix this would be greatly appreciated!任何如何解决此问题的想法将不胜感激!
Interestingly, it started working three hours later.有趣的是,它在三个小时后开始工作。 I didn't change anything and all things remain the same as I described above.我没有改变任何东西,所有的东西都和我上面描述的一样。 I have no clue why this is the case...我不知道为什么会这样……
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.