使用ec2 postgres数据库连接heroku django app

时间:2013-01-26 23:53:50

标签: python django heroku amazon-ec2

我在heroku上运行了一个django应用程序。它适用于heroku提供的5 MB数据库。

我有一个ec2实例,我安装了postgresql数据库并根据以下答案设置了数据库Setting Up Django and PostgreSQL on two different EC2 instances

我在PG的安全组中添加了自定义TCP端口5432。

要将我的heroku应用程序与EC2上的postgresql数据库连接,我尝试以下

heroku config:add DATABASE_URL=\
postgres://my_database_name:my_database_password@\
<Public_DNS>:<PORT>/my_user_name

完成此操作后,我尝试heroku run python manage.py syncdb,然后收到错误:

psycopg2.OperationalError: could not connect to server: Connection timed out
    Is the server running on host "......compute-1.amazonaws.com" and accepting
    TCP/IP connections on port 5432?

请让我知道,出了什么问题?

1 个答案:

答案 0 :(得分:0)

检查主机是否仍然可用。我认为这可能是个问题。

heroku config | grep HEROKU_POSTGRESQL显示什么?

它是否提供与

中所见相同的主机
"could not connect to server: Connection timed out
    Is the server running on host "......compute-1.amazonaws.com"
相关问题