我从头开始创建了一个rails应用程序(Rails 4.1.0),我遇到了一个我无法解决的问题.我已经安装并配置了Apache Passenger Module,它运行正常.每当我尝试访问虚拟主机时,都会收到错误500:
Missing secret_key_base for 'production' environment,set this value in config/secrets.yml
secret.yml文件包含以下配置:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
即使我不建议我这样做:
production: secret_key_base: XXXXXXXXXXXXXXXXXXXXXXXXXXXX (random key)
但Apache日志显示:
# tailf /etc/httpd/logs/error_log [Tue May 06 12:56:18 2014] [error] [client 192.168.3.1] Premature end of script headers: App 4405 stderr: [ 2014-05-06 12:56:18.5763 4421/0x9d48bdc(Worker 1) utils.rb:68 ]: *** Exception RuntimeError in Rack application object (Missing `secret_key_base` for 'production' environment,set this value in `config/secrets.yml`) (process 4421,thread 0x9d48bdc(Worker 1)): App 4405 stderr: from /usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.0/lib/rails/application.rb:440:in `validate_secret_key_config!' App 4405 stderr: from /usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.0/lib/rails/application.rb:195:in `env_config' App 4405 stderr: from /usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.0/lib/rails/engine.rb:510:in `call' App 4405 stderr: from /usr/local/rvm/gems/ruby-2.1.1/gems/railties-4.1.0/lib/rails/application.rb:144:in `call' App 4405 stderr: from /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41/lib/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request' App 4405 stderr: from /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41/lib/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request' App 4405 stderr: from /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41/lib/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop' App 4405 stderr: from /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41/lib/phusion_passenger/request_handler.rb:448:in `block (3 levels) in start_threads'
我该如何解决这个错误?我如何访问开发环境?我的意思是我如何编写代码,在浏览器中测试然后部署到Heroku或只是在生产环境中进行测试?
更新
我设法通过在VirtualHost上设置RailsEnv开发来修复上面的错误,但现在我得到了另一个错误:
sqlite3::CantOpenException unable to open database file
Rails.root: /var/www/html/moviedb