我在部署rails 3.1時遇到了問題。應用到heroku。部署Rails 3.1應用程序到heroku錯誤(sqlite3-> Postgresql)?
經過一番研究,我發現這個問題的主要原因是 - http://devcenter.heroku.com/articles/how-do-i-use-sqlite3-for-development
改變我的寶石文件後:
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
仍然是「很抱歉,但表示有錯誤。」頁面錯誤。
這裏是日誌文件:
←[36m2011-11-26T16:34:31+00:00 heroku[api]:←[0m Add-on add logging:basic by emil
[email protected]
←[36m2011-11-26T16:34:31+00:00 heroku[api]:←[0m Release v2 created by emils.veve
[email protected]
←[36m2011-11-26T16:34:31+00:00 heroku[api]:←[0m Add-on update shared-database
←[36m2011-11-26T16:34:31+00:00 heroku[api]:←[0m Release v3 created by emils.veve
[email protected]
←[33m2011-11-26T16:43:15+00:00 heroku[slugc]:←[0m Slug compilation started
←[36m2011-11-26T16:44:17+00:00 heroku[api]:←[0m Deploy 277a3f4 by [email protected]
thrillengine.com
←[36m2011-11-26T16:44:17+00:00 heroku[api]:←[0m Release v4 created by emils.veve
[email protected]
←[32m2011-11-26T16:44:18+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[33m2011-11-26T16:44:18+00:00 heroku[slugc]:←[0m Slug compilation finished
←[32m2011-11-26T16:44:28+00:00 heroku[web.1]:←[0m State changed from starting to
up
←[35m2011-11-26T17:09:51+00:00 heroku[nginx]:←[0m 81.198.241.178 - - [26/Nov/201
1:09:09:51 -0800] "GET/HTTP/1.1" 500 728 "-" "Mozilla/5.0 (Windows NT 5.1; rv:
8.0) Gecko/20100101 Firefox/8.0" stormy-night-6239.heroku.com
←[32m2011-11-26T18:12:59+00:00 heroku[web.1]:←[0m Idling
←[32m2011-11-26T18:13:00+00:00 heroku[web.1]:←[0m State changed from up to down
←[32m2011-11-26T18:13:00+00:00 heroku[web.1]:←[0m State changed from down to cre
ated
←[32m2011-11-26T18:13:01+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[32m2011-11-26T18:13:02+00:00 heroku[web.1]:←[0m Stopping process with SIGTERM
←[32m2011-11-26T18:13:02+00:00 app[web.1]:←[0m >> Stopping ...
←[32m2011-11-26T18:13:02+00:00 heroku[web.1]:←[0m Process exited
←[32m2011-11-26T18:13:11+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
me Crazy Delicious)
←[32m2011-11-26T18:13:11+00:00 app[web.1]:←[0m >> Maximum connections set to 102
4
←[32m2011-11-26T18:13:11+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:29604, CT
RL+C to stop
←[32m2011-11-26T18:13:12+00:00 heroku[web.1]:←[0m State changed from starting to
up
←[32m2011-11-26T19:16:24+00:00 heroku[web.1]:←[0m Idling
←[32m2011-11-26T19:16:25+00:00 heroku[web.1]:←[0m State changed from up to down
←[32m2011-11-27T11:29:48+00:00 heroku[web.1]:←[0m Unidling
←[32m2011-11-27T11:29:48+00:00 heroku[web.1]:←[0m State changed from down to cre
ated
←[32m2011-11-27T11:29:50+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[32m2011-11-27T11:29:53+00:00 heroku[web.1]:←[0m Starting process with command
`thin -p 16668 -e production -R /home/heroku_rack/heroku.ru start`
←[32m2011-11-27T11:29:59+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
me Crazy Delicious)
←[32m2011-11-27T11:29:59+00:00 app[web.1]:←[0m >> Maximum connections set to 102
4
←[32m2011-11-27T11:29:59+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:16668, CT
RL+C to stop
←[32m2011-11-27T11:30:00+00:00 heroku[web.1]:←[0m State changed from starting to
up
←[31m2011-11-27T11:30:01+00:00 heroku[router]:←[0m GET stormy-night-6239.heroku.
com/ dyno=web.1 queue=0 wait=0ms service=230ms status=500 bytes=728
我沒有看到任何錯誤存在。
我也嘗試運行的Heroku耙分貝:遷移 而gotthis錯誤:
rake aborted!
An error has occurred, this and all later migrations canceled:
PGError: ERROR: column "location_id" of relation "trips" already exists
: ALTER TABLE "trips" ADD COLUMN "location_id" integer
目前我真的不明白什麼,在哪裏看,什麼改變。 一切工作正常我的本地機器,強硬!
感謝您的任何幫助/ ROR新手!
UPDATE:
Heroku的耙分貝之後:重新
Couldn't drop dahrzbhlza : #<ActiveRecord::StatementInvalid: PGError: ERROR: mu
st be owner of database dahrzbhlza
: DROP DATABASE IF EXISTS "dahrzbhlza">
dahrzbhlza already exists
-- create_table("categories", {:force=>true})
-> 0.0595s
-- create_table("categories_trips", {:id=>false, :force=>true})
-> 0.0031s
-- create_table("details", {:force=>true})
-> 0.0129s
-- create_table("details_trips", {:id=>false, :force=>true})
-> 0.0042s
-- create_table("images", {:force=>true})
-> 0.1982s
-- create_table("locations", {:force=>true})
-> 0.1065s
-- create_table("trips", {:force=>true})
-> 0.0422s
-- create_table("users", {:force=>true})
-> 0.1486s
-- add_index("users", ["email"], {:name=>"index_users_on_email", :unique=>true})
-> 0.0102s
-- initialize_schema_migrations_table()
-> 0.0017s
-- assume_migrated_upto_version(20111116120713, ["/app/db/migrate"])
-> 0.0091s
Heroku的耙分貝後:遷移:重做
== AddTitleToImages: reverting ===============================================
-- remove_column("images", :title)
-> 0.0058s
== AddTitleToImages: reverted (0.0059s) ======================================
== AddTitleToImages: migrating ===============================================
-- add_column(:images, :title, :string)
-> 0.0032s
== AddTitleToImages: migrated (0.0033s) ======================================
另一個問題 - 爲什麼它被移植只有這兩個上面列 - 不是全部?
這真的有效!感謝大家的幫助。 – emilsw