如何在rails上的ruby中启用开发模式或显示错误

时间:2023-01-16 10:28:31

When I browse the site I get:

当我浏览网站时,我得到:

We're sorry, but something went wrong.

as I've seen its a 500.html file, so its some internal server error, but how can I make display those errors?

因为我已经看到它的500.html文件,所以它的一些内部服务器错误,但我怎样才能显示那些错误?

I've tried this:

我试过这个:

1) putting ENV['RAILS_ENV'] ||= 'development'in environment.rb, but nothing happened

1)在环境.rb中放置ENV ['RAILS_ENV'] || ='development',但什么也没发生

2) config.log_level = :any, then looked at the production.log, but there is not 500 errors

2)config.log_level =:any,然后查看production.log,但没有500错误

Or what I need to write in the 500.html to see errors?, or just display it no matter how.

或者我需要在500.html中编写什么来查看错误?或者只是显示它,无论如何。

1 个解决方案

#1


3  

Your log files (wherever they're written) should contain your errors.

您的日志文件(无论它们写在何处)都应包含您的错误。

If you still like to view the errors in the browser you could change the following in your environment/production.rb (but consider it as a temporary work-around). Make sure to switch it back.

如果您仍想在浏览器中查看错误,可以在environment / production.rb中更改以下内容(但请将其视为临时解决方法)。确保将其切换回来。

config.consider_all_requests_local = true

config.consider_all_requests_local = true

#1


3  

Your log files (wherever they're written) should contain your errors.

您的日志文件(无论它们写在何处)都应包含您的错误。

If you still like to view the errors in the browser you could change the following in your environment/production.rb (but consider it as a temporary work-around). Make sure to switch it back.

如果您仍想在浏览器中查看错误,可以在environment / production.rb中更改以下内容(但请将其视为临时解决方法)。确保将其切换回来。

config.consider_all_requests_local = true

config.consider_all_requests_local = true