在Azure上部署Web应用程序(通过Linux虚拟机)后,我成功访问了主页(第一页),但在我尝试登录时(navabar的右上角)出现此错误:
我抬头看了这个问题,我看到其他人都有。他们通过重置和迁移来解决它,但它不起作用。到目前为止,我尝试过:
RAILS_ENV=production rake db:drop db:create db:migrate
我认为错误是由于宝石devise
或宝石rails_admin
,但我无法解决问题。
Gemfile:
source 'https://rubygems.org'
ruby '2.6.0'
gem 'grape'
gem 'bootsnap', require: false
gem 'devise'
gem 'jbuilder', '~> 2.0'
gem 'pg', '~> 0.21'
gem 'puma'
gem 'rails', '5.2.2'
gem 'redis'
gem "mini_magick"
gem "chartkick"
gem 'country-select'
gem 'rails_admin', '~> 1.3'
gem 'activestorage-validator'
gem 'rubyzip', '>= 1.2.1'
gem 'axlsx', git: 'https://github.com/randym/axlsx.git', ref: 'c8ac844'
gem 'axlsx_rails'
gem 'autoprefixer-rails'
gem 'bootstrap-sass', '~> 3.3'
gem 'font-awesome-sass', '~> 5.5.0'
gem 'sassc-rails'
gem 'simple_form'
gem 'uglifier'
gem 'webpacker'
group :development do
gem 'web-console', '>= 3.3.0'
end
group :development, :test do
gem 'pry-byebug'
gem 'pry-rails'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'dotenv-rails'
end
database.yml的内容:
default: &default
adapter: postgresql
encoding: utf-8
database: caoee
username: mat
password: ***
pool: 5
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
adapter: postgresql
encoding: utf-8
database: caoee
username: mat
password: ***
pool: 5
test:
<<: *default
adapter: postgresql
encoding: utf-8
database: caoee
username: mat
password: ***
pool: 5
production:
adapter: postgresql
encoding: utf-8
database: caoee
username: mat
password: ***
pool: 5
Postgresql角色:
角色列表
Role name | Attributes | Member of
-----------------------------------
mat | Superuser, Create role, Create DB | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS|{}
你在本地运行那个命令RAILS_ENV=production ...
吗?因为这将只在本地运行命令,具有生产设置。
您需要重置Azure服务器上的数据库。我不熟悉Azure CLI,但我确信有远程重置数据库的命令。