Ruby on rails 当我尝试在本地访问我的应用程序时,我会被告知:“您可以访问我的应用程序。”;无法翻译主机名。。。解决;及;名称解析暂时失败“;
我正在学习Heroku的入门教程。据我所知,Postgres已完全更新,所有内容都已正确安装。有趣的是,当我将应用程序部署到heroku时,它可以在线运行,但当我尝试在本地运行应用程序时,就没有那么多了!我得到一个: PG::连接不良Ruby on rails 当我尝试在本地访问我的应用程序时,我会被告知:“您可以访问我的应用程序。”;无法翻译主机名。。。解决;及;名称解析暂时失败“;,ruby-on-rails,git,postgresql,heroku,Ruby On Rails,Git,Postgresql,Heroku,我正在学习Heroku的入门教程。据我所知,Postgres已完全更新,所有内容都已正确安装。有趣的是,当我将应用程序部署到heroku时,它可以在线运行,但当我尝试在本地运行应用程序时,就没有那么多了!我得到一个: PG::连接不良 could not translate host name "myname" to address: Temporary failure in name resolution 我没有触及Heroku为本教程创建的文件中的任何信息——那么有什么
could not translate host name "myname" to address: Temporary failure in name resolution
我没有触及Heroku为本教程创建的文件中的任何信息——那么有什么可能是错误的呢
已运行以下命令:
heroku登录git克隆
cd ruby入门
heroku创建
git push heroku main
heroku打开(这可以进入应用程序了)
heroku日志——tail
哪个psql
捆绑安装
export DATABASE_URL=postgres://$(whoami)
bundle exec rake db:create db:migrate(这里是错误所在)
heroku本地网站
(此处有错误)http://localhost:5000/ 这是试图连接到一台与您的本地用户帐户同名的计算机。毫不奇怪,它不存在,因此出现了错误 这是试图连接到一台与您的本地用户帐户同名的计算机。毫不奇怪,它不存在,因此出现错误。Debug Postgres connection 确认Postgres存在于您的本地计算机中,正在运行,并且有一个用户使用您的计算机用户名 尝试在本地计算机上运行此命令:
psql -U $(whoami) -d postgres
输出应如下所示:
psql (9.2.24, server 10.14)
WARNING: psql version 9.2, server version 10.0.
Some psql features might not work.
Type "help" for help.
postgres=#
然后,用“\l”确认存在与您的用户名匹配的数据库
提示:您可以使用“\q”关闭
如果没有错误,请尝试用以下内容之一替换数据库\u URL的值
postgresql://
postgresql://localhost
postgresql://localhost:5433
postgresql://localhost/mydb
postgresql://user@localhost
如果此操作不成功,则必须检查postgres的安装方式
…或在Postgres中手动创建具有密码的superadmin用户
连接字符串模式为
postgres://user:password@主机:端口
例如
export DATABASE_URL=postgres://db_user:123456@localhost:5432
调试Postgres连接
确认Postgres存在于您的本地计算机中,正在运行,并且有一个用户使用您的计算机用户名
尝试在本地计算机上运行此命令:
psql -U $(whoami) -d postgres
输出应如下所示:
psql (9.2.24, server 10.14)
WARNING: psql version 9.2, server version 10.0.
Some psql features might not work.
Type "help" for help.
postgres=#
然后,用“\l”确认存在与您的用户名匹配的数据库
提示:您可以使用“\q”关闭
如果没有错误,请尝试用以下内容之一替换数据库\u URL的值
postgresql://
postgresql://localhost
postgresql://localhost:5433
postgresql://localhost/mydb
postgresql://user@localhost
如果此操作不成功,则必须检查postgres的安装方式
…或在Postgres中手动创建具有密码的superadmin用户
连接字符串模式为
postgres://user:password@主机:端口
例如
export DATABASE_URL=postgres://db_user:123456@localhost:5432
显示database.yml文件。显示database.yml文件。我可以做些什么来解决此问题?抱歉,我对此非常陌生。我可以如何解决此问题?对不起,我对这个很陌生