deploy rails app on heroku
Hey I'm afraid I should ask a rookie question :
After push my app to heroku. I got error of no database
This is the command I use
herok开发者_如何学Cu rake db:migrate
My app can run locally with no problem, but I notice the database file only in development.
and my test evironment only use rails server
and localhost:3000
anyone tell me how to make the database in production mode in heroku.
Thanks
here's the heroku log file:
here's the logs
Started GET "/drummers/1" for 221.9.247.14 at Sat Dec 18 06:17:40 -0800 2010 Processing by DrummersController#show as HTML Parameters: {"id"=>"1"} Completed in 167ms
ActiveRecord::RecordNotFound (Couldn't find Drummer with ID=1): app/controllers/drummers_controller.rb:11:in `show'
I think it may due to the datebase,config file, become I use sqlite3 in local test, and all the migration file is development prefix,
It's not telling you that you have no Database.
It's telling you that it can't find a specific record
(Couldn't find Drummer with ID=1):
It's likely that you have code that's doing Drummer.find(1)
and that doesn't exist on your production environment.
Recommend you either:
- create a seeds file (heroku rake db:seed) rails cast
- push your entire database to heroku (heroku db:push) [make sure you understand this will wipe out your production database]
Heroku creates a database for each application deployed to it (no need to run heroku rake db:create
. Here are the commands you should be using to deploy a Rails application to Heroku:
git init
git add .
git commit -m "initial import"
heroku create
git push heroku master
heroku rake db:migrate
heroku open
I believe Heroku creates a new database.yml for you on deploy if you have no production according to the Docs.
精彩评论