我使用的是免费的Nitrous.IO盒子,应用程序在开发模式下运行正常,但这就是我在生产模式下所获得的:
=> Booting Puma
=> Rails 4.0.0 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Puma 2.8.1 starting...
* Min threads: 0, max threads: 16
* Environment: production
* Listening on tcp://0.0.0.0:3000
I, [2014-03-31T01:21:24.636846 #25073] INFO -- : Started GET "/" for 50.9.170.255 at 2014-03-31 01:21:24 +0000
I, [2014-03-31T01:21:24.666459 #25073] INFO -- : Processing by PostsController#index as HTML
E, [2014-03-31T01:21:24.690904 #25073] ERROR -- : PG::UndefinedTable: ERROR: relation "users" does not exist
LINE 1: SELECT "users".* FROM "users" WHERE "users"."id" = 2 ORDE...
^
: SELECT "users".* FROM "users" WHERE "users"."id" = 2 ORDER BY "users"."id" ASC LIMIT 1
I, [2014-03-31T01:21:24.692268 #25073] INFO -- : Completed 500 Internal Server Error in 25ms
F, [2014-03-31T01:21:24.695776 #25073] FATAL -- :
ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "users" does not exist
LINE 1: SELECT "users".* FROM "users" WHERE "users"."id" = 2 ORDE...
^
: SELECT "users".* FROM "users" WHERE "users"."id" = 2 ORDER BY "users"."id" ASC LIMIT 1):
activerecord (4.0.0) lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `async_exec'
activerecord (4.0.0) lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `exec_no_cache'
activerecord (4.0.0) lib/active_record/connection_adapters/postgresql/database_statements.rb:138:in `block in exec_query'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract_adapter.rb:425:in `block in log'
activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract_adapter.rb:420:in `log'
activerecord (4.0.0) lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
activerecord (4.0.0) lib/active_record/connection_adapters/postgresql_adapter.rb:885:in `select'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/database_statements.rb:24:in `select_all'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/query_cache.rb:61:in `block in select_all'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/query_cache.rb:76:in `cache_sql'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/query_cache.rb:61:in `select_all'
activerecord (4.0.0) lib/active_record/querying.rb:36:in `find_by_sql'
activerecord (4.0.0) lib/active_record/relation.rb:585:in `exec_queries'
activerecord (4.0.0) lib/active_record/relation.rb:471:in `load'
activerecord (4.0.0) lib/active_record/relation.rb:220:in `to_a'
activerecord (4.0.0) lib/active_record/relation/finder_methods.rb:325:in `find_first'
activerecord (4.0.0) lib/active_record/relation/finder_methods.rb:90:in `first'
activerecord-deprecated_finders (1.0.3) lib/active_record/deprecated_finders/relation.rb:129:in `first'
orm_adapter (0.5.0) lib/orm_adapter/adapters/active_record.rb:17:in `get'
devise (3.2.4) lib/devise/models/authenticatable.rb:208:in `serialize_from_session'
devise (3.2.4) lib/devise.rb:462:in `block (2 levels) in configure_warden!'
warden (1.2.3) lib/warden/session_serializer.rb:34:in `fetch'
warden (1.2.3) lib/warden/proxy.rb:212:in `user'
warden (1.2.3) lib/warden/proxy.rb:318:in `_perform_authentication'
warden (1.2.3) lib/warden/proxy.rb:127:in `authenticate!'
devise (3.2.4) lib/devise/controllers/helpers.rb:50:in `authenticate_user!'
activesupport (4.0.0) lib/active_support/callbacks.rb:417:in `_run__2080870772581885230__process_action__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.0) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:655: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'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.0) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__2769160116473194702__call__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
railties (4.0.0) lib/rails/engine.rb:511:in `call'
railties (4.0.0) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
puma (2.8.1) lib/puma/server.rb:490:in `handle_request'
puma (2.8.1) lib/puma/server.rb:361:in `process_client'
puma (2.8.1) lib/puma/server.rb:254:in `block in run'
puma (2.8.1) lib/puma/thread_pool.rb:92:in `call'
puma (2.8.1) lib/puma/thread_pool.rb:92:in `block in spawn_thread'
更新:
我设法通过运行db:create来创建productoction数据库,我可以在生产模式下启动,但我的css都没有加载,所以我建议我运行下面的命令但是让rake中止! 运行后
bundle exec rake assets:precompile RAILS_ENV=production
我明白了
rake aborted!
Sass::SyntaxError: Invalid CSS after " background:": expected pseudoclass or pseudoelement, was "/* homepage */"
(in /home/action/booklist/app/assets/stylesheets/application.css)
(sass):1186
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/scss/parser.rb:1147:in `expected'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/scss/parser.rb:1085:in `expected'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/scss/parser.rb:1067:in `expr!'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/scss/parser.rb:794:in `pseudo'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/scss/parser.rb:678:in `simple_selector_sequence'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/scss/parser.rb:640:in `_selector'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/scss/parser.rb:619:in `selector'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/scss/parser.rb:603:in `selector_sequence'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/scss/parser.rb:528:in `ruleset'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/scss/parser.rb:553:in `block_child'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/scss/parser.rb:546:in `block_contents'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/scss/parser.rb:82:in `stylesheet'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/scss/parser.rb:27:in `parse'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/engine.rb:342:in `_to_tree'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/engine.rb:315:in `_render'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.18/lib/sass/engine.rb:262:in `render'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/sass_compressor.rb:24:in `evaluate'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets- 2.11.0/lib/sprockets/context.rb:197:in `block in evaluate'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `each'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `evaluate'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/bundled_asset.rb:25:in `initialize'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `new'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `build_asset'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/index.rb:94:in `block in build_asset'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/caching.rb:58:in `cache_asset'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:in `build_asset'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in `find_asset'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:in `find_asset'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:257:in `benchmark'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:210:in `find_asset'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:119:in `block in compile'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `each'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `compile'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-2.11.0/lib/rake/sprocketstask.rb:146:in `with_logger'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
/home/action/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
/home/action/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => assets:precompile