连接到EC2 Django开发服务器连接到、服务器、Django

2023-09-11 08:20:29 作者:逗比男神!

我是新来的EC2和web开发。目前,我有一个Linux EC2实例中运行,并且已经安装的Django。我创建一个测试项目开始之前,我对我的真正的项目,并试图运行Django的测试服务器。

I am new to EC2 and web development. Currently I have a Linux EC2 instance running, and have installed Django. I am creating a test project before I start on my real project and tried running a Django test server.

这是我在shell输出:

This is my output in the shell:

python manage.py runserver ec2-###-##-##-##.compute-1.amazonaws.com:8000
Validating models...

0 errors found
Django version 1.3, using settings 'testsite.settings'
Development server is running at http://ec2-###-##-##-##.compute-1.amazonaws.com:8000/
Quit the server with CONTROL-C.

要测试它wroking我已经试过访问: EC2 - ### - ## - ## - ## compute-1.amazonaws.com:8000但我总是得到一个无法连接的消息,从我的浏览器。

To test that it is wroking I have tried visiting: ec2-###-##-##-##.compute-1.amazonaws.com:8000 but I always get a "Cannot connect" message from my browser.

每当我这样做lcoally我的电脑上,但是我也成功地得到Django开发主页,网址为127.0.0.1:8000。可能有人帮我找出我在做什么错误/可能会丢失,当我在我的EC2实例这样做,而不是我自己的笔记本电脑?

Whenever I do this lcoally on my computer however I do successfully get to the DJango development home page at 127.0.0.1:8000. Could someone help me figure out what I am doing wrong / might be missing when I am doing this on my EC2 instance as opposed to my own laptop?

推荐答案

您可能没有8000端口在防火墙上打开。检查其安全组的实例运行(可能是默认),检查正在运行的规则。你可能会发现8000端口没有被列出。

You probably don't have port 8000 open on the firewall. Check which security group your instance is running (probably "default") and check the rules it is running. You will probably find that port 8000 is not listed.