2013-05-02 57 views
0

我想部署我的舊網站Heroku的。 一切順利,它啓動,但是當我通過Web瀏覽器訪問它,我得到的Heroku的Rails + + GEOIP =未初始化的常量GeoIP的錯誤

NameError (uninitialized constant ApplicantsController::GeoIP): 

我使用Rails 2.3.18(我的網站是很簡單,只是想部署它「,因爲它是「和儘快;在專用服務器上的一切運作良好)。

我有一個GeoIP.dat文件在 'DB' 文件夾,並在控制器/ applicants_controller.rb我

line 32: geoip ||= GeoIP.new("db/GeoIP.dat") 
line 33: location = geoip.country('google.com') 

如果我啓動在Heroku一切IRB看起來不錯:

[email protected]:~$ heroku run bash 
Running `bash` attached to terminal... up, run.7785 
~ $ irb 
irb(main):001:0> require 'geoip' 
=> true 
irb(main):002:0> geoip ||= GeoIP.new("db/GeoIP.dat") 
=> #<GeoIP:0x00000002b3a6a8 @mutex=#<Mutex:0x00000002b3a680>, @flags=0, @database_type=1, @record_length=3, @file=#<File:db/GeoIP.dat>, @database_segments=[16776960]> 
irb(main):004:0> geoip.country('google.com') 
=> #<struct GeoIP::Country request="google.com", ip="74.125.228.110", country_code=225, country_code2="US", country_code3="USA", country_name="United States", continent_code="NA"> 
irb(main):005:0> 

這裏充滿錯誤日誌。

2013-05-02T13:08:25.938481+00:00 app[web.1]: Processing ApplicantsController#create (for 87.207.27.219 at 2013-05-02 13:08:25) [POST] 
2013-05-02T13:08:25.938481+00:00 app[web.1]: Parameters: {"status"=>"complete"} 
2013-05-02T13:08:26.029730+00:00 app[web.1]: 
2013-05-02T13:08:26.029730+00:00 app[web.1]: NameError (uninitialized constant ApplicantsController::GeoIP): 
2013-05-02T13:08:26.029730+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-2.3.18/lib/active_support/dependencies.rb:131:in `rescue in const_missing' 
2013-05-02T13:08:26.029730+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/filters.rb:610:in `perform_action_with_filters' 
2013-05-02T13:08:26.029730+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/benchmarking.rb:68:in `block in perform_action_with_benchmark' 
2013-05-02T13:08:26.030057+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/rescue.rb:160:in `perform_action_with_rescue' 
2013-05-02T13:08:26.030057+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/flash.rb:151:in `perform_action_with_flash' 
2013-05-02T13:08:26.030057+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/dispatcher.rb:87:in `dispatch' 
2013-05-02T13:08:26.030057+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/dispatcher.rb:121:in `_call' 
2013-05-02T13:08:26.030298+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-2.3.18/lib/active_record/query_cache.rb:29:in `block in call' 
2013-05-02T13:08:26.030298+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/session/cookie_store.rb:99:in `call' 
2013-05-02T13:08:26.030520+00:00 app[web.1]: <internal:prelude>:10:in `synchronize' 
2013-05-02T13:08:26.029730+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-2.3.18/lib/active_support/dependencies.rb:120:in `const_missing' 
2013-05-02T13:08:26.030057+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/base.rb:532:in `process' 
2013-05-02T13:08:26.030057+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/dispatcher.rb:130:in `block in build_middleware_stack' 
2013-05-02T13:08:26.029730+00:00 app[web.1]: app/controllers/applicants_controller.rb:32:in `create' 
2013-05-02T13:08:26.030057+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/base.rb:391:in `process' 
2013-05-02T13:08:26.030298+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-2.3.18/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call' 
2013-05-02T13:08:26.029730+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/filters.rb:617:in `call_filters' 
2013-05-02T13:08:26.030057+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/base.rb:386:in `call' 
2013-05-02T13:08:26.030298+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-2.3.18/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache' 
2013-05-02T13:08:26.029730+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/base.rb:1333:in `perform_action' 
2013-05-02T13:08:26.030057+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/filters.rb:606:in `process_with_filters' 
2013-05-02T13:08:26.030298+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-2.3.18/lib/active_record/query_cache.rb:29:in `call' 
2013-05-02T13:08:26.029730+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark' 
2013-05-02T13:08:26.030057+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/routing/route_set.rb:438:in `call' 
2013-05-02T13:08:26.030298+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-2.3.18/lib/active_record/query_cache.rb:9:in `cache' 
2013-05-02T13:08:26.030298+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-2.3.18/lib/active_record/query_cache.rb:28:in `call' 
2013-05-02T13:08:26.030298+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/params_parser.rb:15:in `call' 
2013-05-02T13:08:26.030520+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/connection.rb:79:in `catch' 
2013-05-02T13:08:26.030298+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/string_coercion.rb:25:in `call' 
2013-05-02T13:08:26.030520+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/connection.rb:79:in `pre_process' 
2013-05-02T13:08:26.030750+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/server.rb:159:in `start' 
2013-05-02T13:08:26.030520+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/connection.rb:54:in `process' 
2013-05-02T13:08:26.030520+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/backends/base.rb:63:in `start' 
2013-05-02T13:08:26.030520+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run' 
2013-05-02T13:08:26.030750+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/runner.rb:187:in `run_command' 
2013-05-02T13:08:26.030520+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/connection.rb:81:in `block in pre_process' 
2013-05-02T13:08:26.030750+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/runner.rb:152:in `run!' 
2013-05-02T13:08:26.030520+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/dispatcher.rb:106:in `call' 
2013-05-02T13:08:26.030750+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/bin/thin:6:in `<top (required)>' 
2013-05-02T13:08:26.030520+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine' 
2013-05-02T13:08:26.030520+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/connection.rb:39:in `receive_data' 
2013-05-02T13:08:26.030750+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/bin/thin:19:in `load' 
2013-05-02T13:08:26.030298+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-2.3.18/lib/action_controller/failsafe.rb:26:in `call' 
2013-05-02T13:08:26.030750+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.5.1/lib/thin/controllers/controller.rb:86:in `start' 
2013-05-02T13:08:26.030750+00:00 app[web.1]: Rendering /app/public/500.html (500 Internal Server Error) 

綁定日誌從Heroku的:

Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment 
    The source :gemcutter is deprecated because HTTP requests are insecure. 
    Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not. 
    Using rake (0.8.7) 
    Using activesupport (2.3.18) 
    Using rack (1.1.6) 
    Using actionpack (2.3.18) 
    Using actionmailer (2.3.18) 
    Using activerecord (2.3.18) 
    Using activeresource (2.3.18) 
    Using daemons (1.1.9) 
    Using eventmachine (1.0.3) 
    Using geoip (1.2.1) 
    Using pg (0.15.1) 
    Using rails (2.3.18) 
    Using thin (1.5.1) 
    Using bundler (1.3.2) 
    Your bundle is complete! It was installed into ./vendor/bundle 

預先感謝您的幫助!

回答

相關問題