我一直在尝试在Django应用上运行heroku run python manage.py migrate
,但我一直收到以下错误消息:
psycopg2.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?
我已经尝试并测试了所有可能的解决方案:编辑pg_hba.conf
和postgresql.conf
,以便psql
侦听所有主机和端口,暂时关闭防火墙和防病毒软件,重新启动{允许我的防火墙中的TCP访问端口psql
后提供{1}}服务;没有一个有效。但是,当我在psql上运行5432
和show port
时,它们分别显示show listen_addresses
和5432
。
我正在命令提示符上运行*
命令,但是我已经通过Windows上的Ubuntu 16.04将本地数据库成功推送到heroku
(尽管我确实必须指定DATABASE_URL
和PGHOST
)。我尝试在Ubuntu以及运行PGPORT
上定义这两个对象,但是我的连接仍然被拒绝。
在Ubuntu上运行migrate
时,psql
显示如下:
netstat
我迷失了其他事情。
谢谢!