Python Heroku Django应用程序上的Postgres本地主机问题
我一辈子也弄不明白这件事。每当我尝试运行数据库迁移(目前使用South for Django 1.6.5)时,都会出现以下错误:Python Heroku Django应用程序上的Postgres本地主机问题,python,django,postgresql,heroku,Python,Django,Postgresql,Heroku,我一辈子也弄不明白这件事。每当我尝试运行数据库迁移(目前使用South for Django 1.6.5)时,都会出现以下错误: conn = _connect(dsn, connection_factory=connection_factory, async=async) django.db.utils.OperationalError: could not connect to server: Connection refused Is the server running on h
conn = _connect(dsn, connection_factory=connection_factory, async=async)
django.db.utils.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
我尝试了我能想到的所有设置配置。我有一个基本、本地和生产设置文件。在我的产品设置文件中,我甚至从heroku网站的信息页面复制了数据库字典值,以确保它们匹配。ex)
}
我没有看到我告诉它查找本地主机的任何地方。您是否检查了应用程序以确保设置了
数据库URL
?它应该指向您试图使用的数据库(HEROKU\u POSTGRESQL\u COLOR\u URL
)。然后,使用@rajasimon提到的dj_database_url.config()
。也请参见此处告诉您如何配置数据库['???']=dj_-database\u-url.config()
?我有数据库['default']=dj_-database\u-url.config(),但它不起作用,所以我包含了我上面提出的精确值。您得到的错误是什么。。?
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'd3...k',
'USER': 'yvg...f',
'PASSWORD': '...',
'HOST': '....amazonaws.com',
'PORT': '5432',
}