I'm pushing changes to Heroku and I get ...
我正在推动对Heroku的改变,我得到......
rake aborted!
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?耙子流产了!无法连接到服务器:连接被拒绝服务器是否在主机“127.0.0.1”上运行并接受端口5432上的TCP / IP连接?
When I consult the Heroku documentation Here, it tells me I need to "configure a nonexistent database in your local config/database.yml" I'm not sure how to create a "nonexistent database"? I'm a beginner and would appreciate any help you can give me. Thanks.
当我查阅Heroku文档时,它告诉我我需要“在本地config / database.yml中配置一个不存在的数据库”我不知道如何创建“不存在的数据库”?我是初学者,非常感谢你能给我的任何帮助。谢谢。
3 个解决方案
#1
29
On Heroku, you must set this line in your config/application.rb:
在Heroku上,您必须在config / application.rb中设置此行:
config.assets.initialize_on_precompile = false
http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets
http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets
For faster asset precompiles, you can partially load your application by setting config.assets.initialize_on_precompile to false in config/application.rb, though in that case templates cannot see application objects or methods. Heroku requires this to be false.
对于更快的资产预编译,您可以通过在config / application.rb中将config.assets.initialize_on_precompile设置为false来部分加载应用程序,但在这种情况下,模板无法查看应用程序对象或方法。 Heroku要求这是假的。
#2
0
It means put in the name of a database that doesn't actually exist in your local dev environment. Then try and run rake assets:precompile
它意味着放入本地开发环境中实际不存在的数据库的名称。然后尝试运行rake资产:预编译
You're simulating the same scenario locally (an unavailable db).
您在本地模拟相同的场景(不可用的数据库)。
Are you using Devise in this app? It had a known issue similar to this. You may want to update that gem.
你在这个应用程序中使用Devise吗?它有一个与此类似的已知问题。您可能想要更新该gem。
#3
0
I ran into the same problem. It seems that for some reason the DATABASE_URL environment variable is not set at the time of asset precompilation. A workaround is to set the DATABASE_URL in the production.rb file. ENV["DATABASE_URL"] = <your db url>
That should fix the problem.
我遇到了同样的问题。似乎由于某种原因,在资产预编译时未设置DATABASE_URL环境变量。解决方法是在production.rb文件中设置DATABASE_URL。 ENV [“DATABASE_URL”] = <你的数据库网址> 那应该解决问题。
#1
29
On Heroku, you must set this line in your config/application.rb:
在Heroku上,您必须在config / application.rb中设置此行:
config.assets.initialize_on_precompile = false
http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets
http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets
For faster asset precompiles, you can partially load your application by setting config.assets.initialize_on_precompile to false in config/application.rb, though in that case templates cannot see application objects or methods. Heroku requires this to be false.
对于更快的资产预编译,您可以通过在config / application.rb中将config.assets.initialize_on_precompile设置为false来部分加载应用程序,但在这种情况下,模板无法查看应用程序对象或方法。 Heroku要求这是假的。
#2
0
It means put in the name of a database that doesn't actually exist in your local dev environment. Then try and run rake assets:precompile
它意味着放入本地开发环境中实际不存在的数据库的名称。然后尝试运行rake资产:预编译
You're simulating the same scenario locally (an unavailable db).
您在本地模拟相同的场景(不可用的数据库)。
Are you using Devise in this app? It had a known issue similar to this. You may want to update that gem.
你在这个应用程序中使用Devise吗?它有一个与此类似的已知问题。您可能想要更新该gem。
#3
0
I ran into the same problem. It seems that for some reason the DATABASE_URL environment variable is not set at the time of asset precompilation. A workaround is to set the DATABASE_URL in the production.rb file. ENV["DATABASE_URL"] = <your db url>
That should fix the problem.
我遇到了同样的问题。似乎由于某种原因,在资产预编译时未设置DATABASE_URL环境变量。解决方法是在production.rb文件中设置DATABASE_URL。 ENV [“DATABASE_URL”] = <你的数据库网址> 那应该解决问题。