PG :: ConnectionBad:运行导出后无法转换主机名错误DATABASE_URL = postgres:// $(whoami)

Jil*_*nig 8 database postgresql pg rails-postgresql

跑完后我收到了这个错误

export DATABASE_URL=postgres://$(whoami)
Run Code Online (Sandbox Code Playgroud)

在命令行上.现在我运行命令

$$ rake db:migrate
Run Code Online (Sandbox Code Playgroud)

这是完整的错误

rake aborted!
PG::ConnectionBad: could not translate host name "Jillian" to address: nodename nor servname provided, or not known

Tasks: TOP => db:migrate
Run Code Online (Sandbox Code Playgroud)

我该如何修复postgres?

PS我正在按照本教程https://devcenter.heroku.com/articles/heroku-postgresql#local-setup为python应用程序设置pg,但我可能有一个旧版本的pg.我试图在运行^之前至少把postgres恢复到原来的状态

Jil*_*nig 9

....你一直在等待的答案:

如果您通过运行导出来搞乱您的开发环境DATABASE_URL=...,如果您处于与上述类似的情况并已在每个项目中设置环境,请通过运行解决此问题

unset DATABASE_URL
Run Code Online (Sandbox Code Playgroud)