我想在Ubuntu的數字海洋部署我的第一個rails應用程序,我不確定我是否做這個權利。測試和生產sqllite。在挫折中,我改變了所有我的數據庫postgres我更改database.yml。我不確定如果我做到了這一點正確但我有這個錯誤:ActiveRecord :: StatementInvalid(SQLite3 :: ReadOnlyException:是sqllite。我不知道是否必須告訴服務器切換到生產模式,或者如果它被配置爲使用sqllite。ActiveRecord :: StatementInvalid(SQLite3 :: ReadOnlyException:當使用postgres
我想要做的是使用postgres而不是sqllite。我使用nginx和我的數據庫是空白的,所以我不需要傳輸任何東西。我做了postgres da在postgres中,我只需要將我的應用程序指向該數據庫即可。 (我不知道如果我需要做些別的事情
我已經使用這個database.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
在什麼情況下你會得到那個錯誤?當你嘗試啓動控制檯?運行服務器? – Bryce
當我嘗試寫入應用程序(發表評論)時發生這種情況:http://104.236.51.180/blogs/10 – applejuiceteaching
您可以運行'rake db:drop db:create db:migrate'嗎?你能登錄到Rails控制檯並通過該接口創建一個Comment對象嗎?如果不是,那麼錯誤是什麼? – Bryce