简体   繁体   English

PostgreSQL和Heroku-无法连接到数据库

[英]PostgreSQL & Heroku - cannot connect to the database

I'm trying to add a column to a table via my Django app with South but keep getting the following error upon running the python manage.py migrate <app name> command: 我正在尝试通过使用South的Django应用程序向表中添加一列,但是在运行python manage.py migrate <app name>命令时python manage.py migrate <app name>出现以下错误:

conn = _connect(dsn, connection_factory=connection_factory, async=async)
psycopg2.OperationalError: could not translate host name "ec2-107-21-99-105.comp
ute-1.amazonaws.com" to address: Temporary failure in name resolution

Does anybody have an idea why this is happening? 有人知道为什么会这样吗? I'm a newbie to both South AND the PostgreSQL database management system (which Heroku uses), so I am more than a bit confused. 我既是South还是PostgreSQL数据库管理系统(Heroku使用)的新手,所以我很困惑。

Make sure you have defined your default database in settings.py like this: 确保已在settings.py定义了默认数据库,如下所示:

DATABASES = {
    'default': dj_database_url.config(default=os.environ.get('DATABASE_URL'))
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM