heroku db:push sqlite://mydatabase.db error

2019-08-31 02:16发布

**When I do "heroku db:push sqlite://mydatabase.db" I have a problem with Ruby + Sinatra + Sqlite3 + Heroku :

When i do : "heroku db:push sqlite://anotador.db"

Console log:

2013-01-21T12:37:11+00:00 app[web.1]: Errno::ENOENT - No such file or directory - /app/views/home.erb:
2013-01-21T12:37:11+00:00 app[web.1]:   /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:572:in `erb'

My anotador.rb :

require 'rubygems'  
require 'sinatra'  
require 'data_mapper'

DataMapper::setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/anotador.db")  
class Nota  
  include DataMapper::Resource  
  property :id, Serial  
  property :content, Text, :required => true  
  property :complete, Boolean, :required => true, :default => false  
  property :created_at, DateTime  
  property :updated_at, DateTime  
end  
DataMapper.finalize.auto_upgrade! 

My GemFile :

source :rubygems
gem 'sinatra'
gem 'data_mapper' 
gem 'rack-flash'
gem 'sinatra-redirect-with-flash'
gem 'builder'
gem 'dm-postgres-adapter', :group => :production
gem 'dm-sqlite-adapter', :group => :development
gem 'thin'

group :development, :test do
  gem 'sqlite3'
end
group :production do
  gem 'pg'
end

In command Line :

$ bundle
$ git init 
$ git add .
$ git commit -m "comentario" 
$ heroku create nombreAPP --stack cedar
$ git push heroku master 

$ heroku addons:add heroku-postgresql:dev
$ heroku pg:promote <DATABASE_URL>  
$ heroku db:push sqlite://anotador.db 

I know Heroku uses Postgres and SQLite not

But Heroku has the ability to move a database and use SQLite to Postgres exemplified in this link:

https://devcenter.heroku.com/articles/ruby # using-a-sql-database

I use sqlite3 in development and in production use Postgres

In GemFile :

group :development, :test do
  gem 'sqlite3'
end
group :production do
  gem 'pg'
end

This link have an example :

http://yamilurbina.com/post/4854924459/deploying-a-sinatra-datamapper-sqlite-app-to-heroku

1条回答
聊天终结者
2楼-- · 2019-08-31 03:07

As far as I know, you cannot use SQLite3 on Heroku. You can use Postgres or Mysql database instead.

So when you say

heroku db:push sqlite://mydatabase.db

You should not be doing that. It will not work because SQLite Gem is not available on Heroku. What is db:push? Is it some rake task? I suppose you would still need to specify that to Heroku.

查看更多
登录 后发表回答