这只发生在heroku上,本地一切正常。
当我注册新用户/或使用现有用户登录我的应用时,我没有收到任何错误消息或任何错误消息。
然而,__main__.py
作为一个例子是行不通的。我仍然使用注册/登录按钮,而不是仪表板作为示例。与active_admin相同,当我尝试登录时,我没有收到任何错误,但它只是重新加载登录页面。这真的很奇怪。
再次,仅限于heroku。当我尝试在本地登录或尝试注册新用户时,一切正常。
Heroku日志显示没有错误(缺少图像文件除外)
python -m PackageName
有什么想法吗?
[更新]
正在运行if user_signed_in?
然后$ heroku logs
2017-02-14T11:48:17.367871+00:00 app[web.1]: Rendered project/index.html.erb within layouts/application (1.4ms)
2017-02-14T11:48:17.369701+00:00 app[web.1]: Rendered shared/_header.html.erb (1.0ms)
2017-02-14T11:48:17.369874+00:00 app[web.1]: Rendered shared/_message.html.erb (0.1ms)
2017-02-14T11:48:17.370124+00:00 app[web.1]: Rendered shared/_footer.html.erb (0.1ms)
2017-02-14T11:48:17.370297+00:00 app[web.1]: Completed 200 OK in 5ms (Views: 3.2ms | ActiveRecord: 0.8ms)
2017-02-14T11:48:17.386624+00:00 heroku[router]: at=info method=GET path="/" host=herogamedev2.herokuapp.com request_id=8b8bf6db-d1bc-420e-bcc0-4efc9591adb0 fwd="94.218.91.178" dyno=web.1 connect=1ms service=13ms status=200 bytes=5750
2017-02-14T11:48:17.514234+00:00 heroku[router]: at=info method=GET path="/assets/application-1d6aff3e9562d68738287f8737bcd49d854bd20cc894434ed3975afebb8addd2.css" host=herogamedev2.herokuapp.com request_id=712f2bda-87a4-427c-ac27-b8297f81008a fwd="94.218.91.178" dyno=web.1 connect=0ms service=3ms status=304 bytes=133
2017-02-14T11:48:17.632465+00:00 heroku[router]: at=info method=GET path="/assets/application-835796ed4ed64d77b216af341c67c9e3ada5866ff071e82dc15b0af01d47e9de.js" host=herogamedev2.herokuapp.com request_id=1a496b53-6500-455e-aada-aa2e535a2802 fwd="94.218.91.178" dyno=web.1 connect=0ms service=4ms status=304 bytes=133
2017-02-14T11:48:17.920864+00:00 heroku[router]: at=info method=GET path="/assets/pexel.jpeg" host=herogamedev2.herokuapp.com request_id=c962257e-2cb6-4c59-86e6-2cc6b6bb81e6 fwd="94.218.91.178" dyno=web.1 connect=1ms service=9ms status=404 bytes=1829
2017-02-14T11:48:17.899656+00:00 app[web.1]: Started GET "/assets/pexel.jpeg" for 94.218.91.178 at 2017-02-14 11:48:17 +0000
2017-02-14T11:48:17.903852+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets/pexel.jpeg"):
2017-02-14T11:48:17.903853+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2017-02-14T11:48:17.903853+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2017-02-14T11:48:17.903850+00:00 app[web.1]:
2017-02-14T11:48:17.903855+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/rack/logger.rb:38:in `call_app'
2017-02-14T11:48:17.903855+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/rack/logger.rb:20:in `block in call'
2017-02-14T11:48:17.903856+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2017-02-14T11:48:17.903857+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/tagged_logging.rb:26:in `tagged'
2017-02-14T11:48:17.903858+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/tagged_logging.rb:68:in `tagged'
2017-02-14T11:48:17.903858+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/rack/logger.rb:20:in `call'
2017-02-14T11:48:17.903859+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2017-02-14T11:48:17.903860+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/methodoverride.rb:22:in `call'
2017-02-14T11:48:17.903860+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/runtime.rb:18:in `call'
2017-02-14T11:48:17.903861+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
2017-02-14T11:48:17.903862+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/static.rb:116:in `call'
2017-02-14T11:48:17.903863+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/engine.rb:518:in `call'
2017-02-14T11:48:17.903864+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/application.rb:165:in `call'
2017-02-14T11:48:17.903864+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/lock.rb:17:in `call'
2017-02-14T11:48:17.903865+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/content_length.rb:15:in `call'
2017-02-14T11:48:17.903866+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/handler/webrick.rb:88:in `service'
2017-02-14T11:48:17.903863+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/sendfile.rb:113:in `call'
2017-02-14T11:48:17.903867+00:00 app[web.1]: vendor/ruby-2.2.6/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
2017-02-14T11:48:17.903868+00:00 app[web.1]: vendor/ruby-2.2.6/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
2017-02-14T11:48:17.903868+00:00 app[web.1]: vendor/ruby-2.2.6/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
2017-02-14T11:48:17.903869+00:00 app[web.1]:
2017-02-14T11:48:17.903870+00:00 app[web.1]:
2017-02-14T11:51:46.157350+00:00 heroku[router]: at=info method=GET path="/" host=herogamedev2.herokuapp.com request_id=b513d122-8920-4580-b4e1-500f535d2ee4 fwd="94.218.91.178" dyno=web.1 connect=0ms service=18ms status=200 bytes=5750
2017-02-14T11:51:46.149910+00:00 app[web.1]: Processing by ProjectController#index as HTML
2017-02-14T11:51:46.143633+00:00 app[web.1]: Started GET "/" for 94.218.91.178 at 2017-02-14 11:51:46 +0000
2017-02-14T11:51:46.152204+00:00 app[web.1]: Project Load (0.6ms) SELECT "projects".* FROM "projects"
2017-02-14T11:51:46.152561+00:00 app[web.1]: Rendered project/index.html.erb within layouts/application (1.3ms)
2017-02-14T11:51:46.155256+00:00 app[web.1]: Rendered shared/_header.html.erb (1.7ms)
2017-02-14T11:51:46.155495+00:00 app[web.1]: Rendered shared/_message.html.erb (0.0ms)
2017-02-14T11:51:46.155858+00:00 app[web.1]: Rendered shared/_footer.html.erb (0.2ms)
2017-02-14T11:51:46.156116+00:00 app[web.1]: Completed 200 OK in 6ms (Views: 4.7ms | ActiveRecord: 0.6ms)
2017-02-14T11:51:46.289308+00:00 heroku[router]: at=info method=GET path="/assets/application-1d6aff3e9562d68738287f8737bcd49d854bd20cc894434ed3975afebb8addd2.css" host=herogamedev2.herokuapp.com request_id=f23301ca-ff2f-4998-9896-5d0f60007f78 fwd="94.218.91.178" dyno=web.1 connect=0ms service=11ms status=304 bytes=133
2017-02-14T11:51:46.734862+00:00 heroku[router]: at=info method=GET path="/assets/pexel.jpeg" host=herogamedev2.herokuapp.com request_id=53d21642-c654-4ed1-ad1f-f5d3e6accf6f fwd="94.218.91.178" dyno=web.1 connect=0ms service=8ms status=404 bytes=1829
2017-02-14T11:51:46.417122+00:00 heroku[router]: at=info method=GET path="/assets/application-835796ed4ed64d77b216af341c67c9e3ada5866ff071e82dc15b0af01d47e9de.js" host=herogamedev2.herokuapp.com request_id=625f2fe6-d3f6-4fbd-a062-1b30cb2d3354 fwd="94.218.91.178" dyno=web.1 connect=0ms service=11ms status=304 bytes=133
2017-02-14T11:51:46.729375+00:00 app[web.1]: Started GET "/assets/pexel.jpeg" for 94.218.91.178 at 2017-02-14 11:51:46 +0000
2017-02-14T11:51:46.733787+00:00 app[web.1]:
2017-02-14T11:51:46.733789+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets/pexel.jpeg"):
2017-02-14T11:51:46.733790+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2017-02-14T11:51:46.733791+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2017-02-14T11:51:46.733792+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/rack/logger.rb:38:in `call_app'
2017-02-14T11:51:46.733793+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/rack/logger.rb:20:in `block in call'
2017-02-14T11:51:46.733793+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2017-02-14T11:51:46.733794+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/tagged_logging.rb:26:in `tagged'
2017-02-14T11:51:46.733795+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/tagged_logging.rb:68:in `tagged'
2017-02-14T11:51:46.733796+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/rack/logger.rb:20:in `call'
2017-02-14T11:51:46.733796+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2017-02-14T11:51:46.733797+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/methodoverride.rb:22:in `call'
2017-02-14T11:51:46.733798+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/runtime.rb:18:in `call'
2017-02-14T11:51:46.733799+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.5.1/lib/action_dispatch/middleware/static.rb:116:in `call'
2017-02-14T11:51:46.733798+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
2017-02-14T11:51:46.733800+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/sendfile.rb:113:in `call'
2017-02-14T11:51:46.733804+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/engine.rb:518:in `call'
2017-02-14T11:51:46.733805+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/application.rb:165:in `call'
2017-02-14T11:51:46.733806+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/lock.rb:17:in `call'
2017-02-14T11:51:46.733806+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/content_length.rb:15:in `call'
2017-02-14T11:51:46.733807+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/handler/webrick.rb:88:in `service'
2017-02-14T11:51:46.733808+00:00 app[web.1]: vendor/ruby-2.2.6/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
2017-02-14T11:51:46.733809+00:00 app[web.1]: vendor/ruby-2.2.6/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
2017-02-14T11:51:46.733809+00:00 app[web.1]: vendor/ruby-2.2.6/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
2017-02-14T11:51:46.733810+00:00 app[web.1]:
2017-02-14T11:51:46.733810+00:00 app[web.1]:
2017-02-14T11:51:51.126778+00:00 app[web.1]: Started GET "/admin/login" for 94.218.91.178 at 2017-02-14 11:51:51 +0000
2017-02-14T11:51:51.131909+00:00 app[web.1]: Processing by ActiveAdmin::Devise::SessionsController#new as HTML
2017-02-14T11:51:51.147797+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-7ff122d58083/app/views/active_admin/devise/shared/_links.erb (2.7ms)
2017-02-14T11:51:51.147851+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-7ff122d58083/app/views/active_admin/devise/sessions/new.html.erb within layouts/active_admin_logged_out (14.6ms)
2017-02-14T11:51:51.148691+00:00 app[web.1]: Completed 200 OK in 17ms (Views: 15.7ms | ActiveRecord: 0.0ms)
2017-02-14T11:51:51.149987+00:00 heroku[router]: at=info method=GET path="/admin/login" host=herogamedev2.herokuapp.com request_id=24f52ba4-5e33-41df-92db-02792e3f3753 fwd="94.218.91.178" dyno=web.1 connect=1ms service=26ms status=200 bytes=3327
2017-02-14T11:51:55.832008+00:00 heroku[router]: at=info method=POST path="/admin/login" host=herogamedev2.herokuapp.com request_id=ee29663a-6e03-4b09-8ca2-2ba566b6e043 fwd="94.218.91.178" dyno=web.1 connect=0ms service=96ms status=302 bytes=1021
2017-02-14T11:51:55.738592+00:00 app[web.1]: Started POST "/admin/login" for 94.218.91.178 at 2017-02-14 11:51:55 +0000
2017-02-14T11:51:55.743302+00:00 app[web.1]: Processing by ActiveAdmin::Devise::SessionsController#create as HTML
2017-02-14T11:51:55.743339+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"RUV3xPCZVfG9OyBE2X25RQmegZQhMqiknxrVWvZH1lhL7cKscTmbODk/kX/qIxtKq85eEgAGJPMYuZLRWY2J6g==", "admin_user"=>{"email"=>"admin@example.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Login"}
2017-02-14T11:51:55.745537+00:00 app[web.1]: AdminUser Load (0.7ms) SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."email" = $1 ORDER BY "admin_users"."id" ASC LIMIT 1 [["email", "admin@example.com"]]
2017-02-14T11:51:55.819195+00:00 app[web.1]: (0.6ms) BEGIN
2017-02-14T11:51:55.820991+00:00 app[web.1]: SQL (0.6ms) UPDATE "admin_users" SET "last_sign_in_at" = $1, "current_sign_in_at" = $2, "sign_in_count" = $3, "updated_at" = $4 WHERE "admin_users"."id" = $5 [["last_sign_in_at", "2017-02-14 11:47:42.774425"], ["current_sign_in_at", "2017-02-14 11:51:55.817737"], ["sign_in_count", 4], ["updated_at", "2017-02-14 11:51:55.819377"], ["id", 1]]
2017-02-14T11:51:55.822643+00:00 app[web.1]: (1.2ms) COMMIT
2017-02-14T11:51:55.830995+00:00 app[web.1]: Completed 302 Found in 88ms (ActiveRecord: 3.0ms)
2017-02-14T11:51:55.830874+00:00 app[web.1]: Redirected to https://herogamedev2.herokuapp.com/admin
2017-02-14T11:51:55.951344+00:00 app[web.1]: Started GET "/admin" for 94.218.91.178 at 2017-02-14 11:51:55 +0000
2017-02-14T11:51:55.955533+00:00 app[web.1]: Processing by Admin::DashboardController#index as HTML
2017-02-14T11:51:55.956112+00:00 app[web.1]: Completed 401 Unauthorized in 1ms (ActiveRecord: 0.0ms)
2017-02-14T11:51:56.106141+00:00 heroku[router]: at=info method=GET path="/admin/login" host=herogamedev2.herokuapp.com request_id=7f27d81e-e1ed-4949-a33c-51a43e806165 fwd="94.218.91.178" dyno=web.1 connect=0ms service=26ms status=200 bytes=3327
2017-02-14T11:51:55.960821+00:00 heroku[router]: at=info method=GET path="/admin" host=herogamedev2.herokuapp.com request_id=6d953372-85c8-464c-ac1d-200326a6f992 fwd="94.218.91.178" dyno=web.1 connect=0ms service=12ms status=302 bytes=1033
2017-02-14T11:51:56.082699+00:00 app[web.1]: Started GET "/admin/login" for 94.218.91.178 at 2017-02-14 11:51:56 +0000
2017-02-14T11:51:56.087109+00:00 app[web.1]: Processing by ActiveAdmin::Devise::SessionsController#new as HTML
2017-02-14T11:51:56.102803+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-7ff122d58083/app/views/active_admin/devise/sessions/new.html.erb within layouts/active_admin_logged_out (14.3ms)
2017-02-14T11:51:56.102750+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-7ff122d58083/app/views/active_admin/devise/shared/_links.erb (2.6ms)
2017-02-14T11:51:56.105098+00:00 app[web.1]: Completed 200 OK in 18ms (Views: 17.0ms | ActiveRecord: 0.0ms)
返回nil。
heroku run rails console
所以似乎设计没有创造任何东西,但是,我没有得到任何错误,再次,仅在heroku,本地我可以注册,登录,注销,编辑和其他一切。
@User.all
答案 0 :(得分:0)
在您推送到Heroku之前看起来您可能没有预编译您的资产,请尝试:
rake assets:precompile
git add .
etc etc
我认为这应该有所帮助。有关详细信息,请参阅此处:see this
答案 1 :(得分:0)
我认为这行来自日志
UPDATE "admin_users" SET "last_sign_in_at" = $1, "current_sign_in_at" = $2, "sign_in_count" = $3, "updated_at" = $4 WHERE "admin_users"."id" = $5 [["last_sign_in_at", "2017-02-14 11:47:42.774425"], ["current_sign_in_at", "2017-02-14 11:51:55.817737"], ["sign_in_count", 4], ["updated_at", "2017-02-14 11:51:55.819377"], ["id", 1]]
告诉我们当您以管理员身份登录时,您的admin_users
表格中的记录已更新。
不幸的是,我不知道你的模型是如何布局的,但最好的办法是你需要查询AdminUser记录。
> AdminUser.all
您还应该确保user_signed_in?
方法处理AdminUsers。发布您的设计配置(在模型中)和任何覆盖都会有所帮助。您是否覆盖了Admin::DashboardController#index
中的任何内容?
设计从会话cookie中读取。你是如何配置你的会话商店的?可能是Heroku有不同的配置吗?