Heroku和Sqlite3的问题

时间:2012-09-13 01:05:43

标签: deployment heroku sqlite github

尝试将一个非常基本的rails应用程序部署到Heroku。它运行在sqlite3上,我在部署它时遇到了一些问题。

首先,我确保宝石中列出的sqlite3正在开发中。这使索引页面最终工作,但现在当我部署它并尝试按照指向实际依赖于我的数据库的页面部分的链接时,heroku错误。我盯着原木看了一会儿,不知道发生了什么,所以我希望有人在这里。我现在就发布一个似乎是最后一个动作的日志(在链接之后):

2012-09-13T01:00:23+00:00 heroku[router]: GET bloc-blog-1.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=187ms status=200 bytes=531
2012-09-13T01:00:24+00:00 heroku[router]: GET bloc-blog-1.herokuapp.com/assets/application-0149f820dbdd285aa65e241569d8c256.css dyno=web.1 queue=0 wait=0ms service=9ms status=200 bytes=811
2012-09-13T01:00:24+00:00 heroku[router]: GET bloc-blog-1.herokuapp.com/assets/application-1c74ddb87f4b5b3c36c58d068d148c95.js dyno=web.1 queue=0 wait=0ms service=9ms status=200 bytes=99469
2012-09-13T01:00:27+00:00 app[web.1]: 
2012-09-13T01:00:27+00:00 app[web.1]: 
2012-09-13T01:00:27+00:00 app[web.1]: Started GET "/posts" for 50.131.223.42 at 2012-09-13 01:00:27 +0000
2012-09-13T01:00:27+00:00 app[web.1]: Processing by PostsController#index as HTML
2012-09-13T01:00:27+00:00 app[web.1]: Completed 500 Internal Server Error in 75ms
2012-09-13T01:00:27+00:00 app[web.1]: 
2012-09-13T01:00:27+00:00 app[web.1]: LINE 4:              WHERE a.attrelid = '"posts"'::regclass
2012-09-13T01:00:27+00:00 app[web.1]:                                         ^
2012-09-13T01:00:27+00:00 app[web.1]: :             SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
2012-09-13T01:00:27+00:00 app[web.1]:               FROM pg_attribute a LEFT JOIN pg_attrdef d
2012-09-13T01:00:27+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR:  relation "posts" does not exist
2012-09-13T01:00:27+00:00 app[web.1]:                 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2012-09-13T01:00:27+00:00 app[web.1]:              WHERE a.attrelid = '"posts"'::regclass
2012-09-13T01:00:27+00:00 app[web.1]: ):
2012-09-13T01:00:27+00:00 app[web.1]: 
2012-09-13T01:00:27+00:00 app[web.1]:   app/controllers/posts_controller.rb:5:in `index'
2012-09-13T01:00:27+00:00 app[web.1]:                AND a.attnum > 0 AND NOT a.attisdropped
2012-09-13T01:00:27+00:00 app[web.1]: 
2012-09-13T01:00:27+00:00 app[web.1]:              ORDER BY a.attnum
2012-09-13T01:00:27+00:00 heroku[router]: GET bloc-blog-1.herokuapp.com/posts dyno=web.1 queue=0 wait=0ms service=86ms status=500 bytes=643

谢谢!

1 个答案:

答案 0 :(得分:1)

Heroku使用PostgreSQL。按照Rails Tutorial Book中的说明在本地安装PostgreSQL,以便您可以复制Heroku数据库环境。 Heroku itself以及几乎每个教程都警告说,在sqlite3中开发然后部署到PostgreSQL会充满危险。