简体   繁体   English

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

[英]How to enable development mode or display errors in ruby on rails

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)在environment.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中编写什么来查看错误?或者只是显示它,无论如何。

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). 如果您仍想在浏览器中查看错误,可以在environment / production.rb中更改以下内容(但请将其视为临时解决方法)。 Make sure to switch it back. 确保将其切换回来。

config.consider_all_requests_local = true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM