1

製油所でプロジェクトを生成しました。開発モード(rails s)で起動すると、問題なく動作します。

しかし、本番モードでは、「申し訳ありませんが、問題が発生しました」というメッセージが表示されます。私はpostgresqlを使用しています。

これは私が端末に持っているものです:

=> Booting WEBrick
=> Rails 3.2.14 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-09-02 19:32:32] INFO  WEBrick 1.3.1
[2013-09-02 19:32:32] INFO  ruby 1.9.3 (2013-02-22) [x86_64-darwin12.1.0]
[2013-09-02 19:32:32] INFO  WEBrick::HTTPServer#start: pid=6216 port=3000
Started GET "/" for 127.0.0.1 at 2013-09-02 19:32:33 +0400
Processing by Refinery::PagesController#home as HTML
  Parameters: {"locale"=>:en}
Completed 500 Internal Server Error in 4ms

ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR:  relation "refinery_pages" does not exist
LINE 5:              WHERE a.attrelid = '"refinery_pages"'::regclass
                                        ^
:             SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
              FROM pg_attribute a LEFT JOIN pg_attrdef d
                ON a.attrelid = d.adrelid AND a.attnum = d.adnum
             WHERE a.attrelid = '"refinery_pages"'::regclass
               AND a.attnum > 0 AND NOT a.attisdropped
             ORDER BY a.attnum
):
  activerecord (3.2.14) lib/active_record/connection_adapters/postgresql_adapter.rb:1163:in `exec'
  activerecord (3.2.14) lib/active_record/connection_adapters/postgresql_adapter.rb:1163:in `exec_no_cache'
  activerecord (3.2.14) lib/active_record/connection_adapters/postgresql_adapter.rb:660:in `block in exec_query'
  activerecord (3.2.14) lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
  activesupport (3.2.14) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activerecord (3.2.14) lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
  activerecord (3.2.14) lib/active_record/connection_adapters/postgresql_adapter.rb:659:in `exec_query'
  activerecord (3.2.14) lib/active_record/connection_adapters/postgresql_adapter.rb:1292:in `column_definitions'
  activerecord (3.2.14) lib/active_record/connection_adapters/postgresql_adapter.rb:855:in `columns'
  activerecord (3.2.14) lib/active_record/connection_adapters/schema_cache.rb:12:in `block in initialize'
  activerecord (3.2.14) lib/active_record/model_schema.rb:229:in `yield'
  activerecord (3.2.14) lib/active_record/model_schema.rb:229:in `default'
  activerecord (3.2.14) lib/active_record/model_schema.rb:229:in `columns'
  activerecord (3.2.14) lib/active_record/model_schema.rb:238:in `columns_hash'
  activerecord (3.2.14) lib/active_record/locking/optimistic.rb:131:in `locking_enabled?'
  activerecord (3.2.14) lib/active_record/relation.rb:170:in `exec_queries'
  activerecord (3.2.14) lib/active_record/relation.rb:160:in `block in to_a'
  activerecord (3.2.14) lib/active_record/explain.rb:41:in `logging_query_plan'
  activerecord (3.2.14) lib/active_record/relation.rb:159:in `to_a'
  activerecord (3.2.14) lib/active_record/relation/finder_methods.rb:381:in `find_first'
  activerecord (3.2.14) lib/active_record/relation/finder_methods.rb:122:in `first'
  refinerycms-pages (2.1.0) app/controllers/refinery/pages_controller.rb:74:in `find_page'
  activesupport (3.2.14) lib/active_support/callbacks.rb:429:in `_run__1554083330414178461__process_action__587527534234291184__callbacks'
  activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.14) lib/abstract_controller/callbacks.rb:17:in `process_action'
  actionpack (3.2.14) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  activesupport (3.2.14) lib/active_support/notifications.rb:123:in `block in instrument'
  activesupport (3.2.14) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (3.2.14) lib/active_support/notifications.rb:123:in `instrument'
  actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  actionpack (3.2.14) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
  activerecord (3.2.14) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (3.2.14) lib/abstract_controller/base.rb:121:in `process'
  actionpack (3.2.14) lib/abstract_controller/rendering.rb:45:in `process'
  actionpack (3.2.14) lib/action_controller/metal.rb:203:in `dispatch'
  actionpack (3.2.14) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  actionpack (3.2.14) lib/action_controller/metal.rb:246:in `block in action'
  actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:73:in `call'
  actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:36:in `call'
  journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  journey (1.0.4) lib/journey/router.rb:56:in `each'
  journey (1.0.4) lib/journey/router.rb:56:in `call'
  actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:608:in `call'
  railties (3.2.14) lib/rails/engine.rb:484:in `call'
  railties (3.2.14) lib/rails/railtie/configurable.rb:30:in `method_missing'
  journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  journey (1.0.4) lib/journey/router.rb:56:in `each'
  journey (1.0.4) lib/journey/router.rb:56:in `call'
  actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:608:in `call'
  warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.3) lib/warden/manager.rb:34:in `catch'
  warden (1.2.3) lib/warden/manager.rb:34:in `call'
  actionpack (3.2.14) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  rack (1.4.5) lib/rack/etag.rb:23:in `call'
  rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
  actionpack (3.2.14) lib/action_dispatch/middleware/head.rb:14:in `call'
  actionpack (3.2.14) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  actionpack (3.2.14) lib/action_dispatch/middleware/flash.rb:242:in `call'
  rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
  rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
  actionpack (3.2.14) lib/action_dispatch/middleware/cookies.rb:341:in `call'
  dragonfly (0.9.15) lib/dragonfly/cookie_monster.rb:9:in `call'
  activerecord (3.2.14) lib/active_record/query_cache.rb:64:in `call'
  activerecord (3.2.14) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  actionpack (3.2.14) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `_run__1159002294727357788__call__463434542207409353__callbacks'
  activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.14) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (3.2.14) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  actionpack (3.2.14) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.14) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.14) lib/rails/rack/logger.rb:32:in `call_app'
  railties (3.2.14) lib/rails/rack/logger.rb:16:in `block in call'
  activesupport (3.2.14) lib/active_support/tagged_logging.rb:22:in `tagged'
  railties (3.2.14) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.14) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.5) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.14) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.5) lib/rack/lock.rb:15:in `call'
  rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
  rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
  rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
  rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
  rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
  railties (3.2.14) lib/rails/engine.rb:484:in `call'
  railties (3.2.14) lib/rails/application.rb:231:in `call'
  rack (1.4.5) lib/rack/content_length.rb:14:in `call'
  railties (3.2.14) lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'

更新 (生産/開発モード): 生産モード 開発モード

4

1 に答える 1

2

エラーは、まだセットアップされていないテーブルがあることを示しています。開発データベースを本番環境にダンプしましたか? または、本番環境のコマンド ラインから次のコマンドを実行して、データベースの新規インストールを開始することもできます。

rake db:migrate
rake db:seed

更新

スタイルシートやその他の静的アセットが実稼働環境で正しくレンダリングされない場合は、アセットのプリコンパイルをセットアップすることをお勧めします。

# config/application.rb
config.assets.initialize_on_precompile = true
于 2013-09-02T16:22:44.063 に答える