连接到 EC2 Django 开发服务器 [英] Connecting to EC2 Django development Server

查看:18
本文介绍了连接到 EC2 Django 开发服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 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.

为了测试它是否有效,我尝试访问: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.

每当我在计算机上执行此操作时,我都会成功地访问 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.

这篇关于连接到 EC2 Django 开发服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆