ruby-on-rails - 如果您是应用程序所有者,请查看日志以获取更多信息。错误 500
问题描述
我在 Rails 中创建了一个带有 SignUp 表单的页面,它在本地运行良好,一切都很好,所以我在 Heroku 中部署了该项目,其中 statics_page 工作得很好,但是这个表单不起作用并且给我抛出了错误:
我们很抱歉,但有些不对劲。
如果您是应用程序所有者,请查看日志以获取更多信息。
所以我查看了日志,一切正常,直到出现红色:
2020-01-26T02:13:09.077537+00:00 heroku[路由器]: at=info method=GET path="/signup" host=safe-shelf-03588.herokuapp.com request_id=a96a3ba1-41ed-4963-8f6a -5cd3676954ff fwd="181.115.249.233" dyno=web.1 连接=0ms 服务=5ms 状态=500 字节=1891 协议=https
我查看了论坛,最合乎逻辑的原因是查看路线,但错误 500 是一个非常常见的问题代码,出于不同的原因,我没有运气......
这是我的 routes.rb 文件:
Rails.application.routes.draw do
get 'users/new'
root 'static_pages#home'
get '/help', to: 'static_pages#help'
get '/about', to: 'static_pages#about'
get '/contact', to: 'static_pages#contact'
get '/signup', to: 'users#new'
resources :users
end
这是我的database.yml:
default: &default
adapter: postgresql
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: 'my_app_development'
test:
<<: *default
database: 'my_app_test'
production:
<<: *default
database: sample_app_production
username: sample_app
password: <%= ENV['SAMPLE_APP_DATABASE_PASSWORD'] %>
我的档案:
web: bundle exec puma -C config/puma.rb
和我的 puma.rb 文件以防万一:
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/
# deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end
解决方案
解决方案是使用以下命令在 Heroku 中重新安装或安装 Postgree DB:
heroku 插件:创建 heroku-postgresql:hobby-dev
制作一个 Rake db:migrate 就是这样
推荐阅读
- json - 当我的 JSON 列是动态的时,JSON 文件到 CSV 文件的转换
- python - 如何获取行(列表)中至少一个元素中包含特定值(字符串)的列表(行)的数量?
- javascript - 如何找到第一个数组和第二个数组之间的差异
- mysql - 为什么两个选择查询的联合不起作用?
- python - 由于 Python 中的循环导入,如何解决类依赖性?
- python - 单击 Python Folium 地图上显示的 GeoJson 图层功能
- reactjs - 为什么在 eventListener 上验证输入不起作用?
- php - 来自 ZIP 存档的 Laravel 文件名列表,显示在刀片中
- python - 如何在python中按自定义顺序对列表进行排序?
- python - 错误:找不到满足 dask-cudf 要求的版本(来自版本:无)