connecting aws rds retun 该主机上的服务器 运行 是否正在接受 TCP/IP 连接?

connecting aws rds retun Is the server running on that host and accepting TCP/IP connections?

我正在尝试将我的应用程序与 aws rds postgresql 数据库连接,我在 heroku 服务器上托管了该应用程序,但是当我尝试 运行 python manage.py makemigrations.

错误:

 Is the server running on that host and accepting TCP/IP connections?

我在 aws 中添加了 rds.force_ssl 并且我下载了它的证书并将其放入我的项目目录中,正如 heroku 所建议的那样。我还在 DATABASE_URL 部分下的 heroku 设置中添加了我的用户名、密码和 url 端点。这是我第一次为我的 Django 应用程序连接实时服务器。而且我没有在我的 windows 机器上下载和安装 postgresql,我认为这不是问题所在。

数据库配置:

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql',
    'NAME': '',
    'USER': '',
    'PASSWORD': '',
    'HOST': '',
    'PORT': '5432',
}

}

我不知道发生了什么。有谁可以帮助我吗

可以看到How to Control Access to RDS with Security Groups

您的问题似乎与安全组有关,您需要编辑您在 RDS 集群上设置的安全组以允许从您的 Heroku IP 地址到数据库端口的连接

哦,我通过在我的 安全组 中添加两条规则并将它们设置为: FOR TYPE to POSTGRESQL 和对于SOURCEAnywhereIPv4

对于那些没有将其数据库设置为可访问的用户,您可以按照此 link here