ActiveRecord::StatementInvalid (SQLite3::ReadOnlyException:



我正在尝试在 Ubuntu 的数字海洋上部署我的第一个 rails 应用程序,我不确定我是否做得对。 我最初将我的生产数据库放在 postgres 中,并在 sqllite 中进行测试和生产。 在沮丧中,我更改了所有数据库以发布我更改的database.yml。 我不确定我是否正确执行此操作,但是我遇到了此错误:ActiveRecord::StatementInvalid (SQLite3::ReadOnlyException: . 当我在 sqllite 的时候。 我不确定我是否必须告诉服务器切换到生产模式,或者它是否配置为使用 sqllite。

我想做的是使用 postgres 而不是 sqllite。 我正在使用nginx和Unicorn。 我的数据库是空白的,所以我不需要传输任何东西。 我已经在 postgres 中制作了 postgres 数据库,我只需要将我的应用程序指向该数据库。 (我不知道我是否需要做其他事情

我用过这个数据库.yml

development:
  adapter: postgresql
  encoding: unicode
  host: localhost
  database: blog_development
  pool: 5
  username: bob
  password: password
test:
  adapter: postgresql
  encoding: unicode
  database: blog_test
  host: localhost
  pool: 5
  username: bob
  password: password
production:
  adapter: postgresql
  encoding: unicode
  host: localhost
  database: blog_production
  pool: 5
  username: bob
  password: password

宝石文件:

source 'https://rubygems.org'
ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.4'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer',  platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'jquery-ui-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring',        group: :development
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
gem 'bootstrap-sass' # for using bootstrap-rails"
gem 'faker'
gem 'will_paginate'
gem 'annotate', '~> 2.6.5'
gem 'font-awesome-rails' # for using font-awesome icons
gem 'redcarpet', '~> 2.1.1'
gem 'coderay', '~> 1.1.0' # For nice code snippets

gem 'devise'
gem 'sidekiq'
gem 'haml-rails'
group :development do
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'meta_request'
  gem 'guard-rspec'
end
group :test do
  gem 'capybara'
  gem 'factory_girl_rails', '4.2.0'
end
gem 'pg', '0.15.1'
group :development, :test do
  gem 'rspec-rails'
  # Use sqlite3 as the database for Active Record in testing
end
group :production do
  gem 'rails_12factor', '0.0.2'
end

我的github上有其余的代码:https://github.com/RubyQuarry/Bootstrap_blog

运行rake db:drop db:create db:drop以删除旧数据库并在 Postgres 中重新创建新数据库。

相关内容

  • 没有找到相关文章

最新更新