尝试将一个非常基本的rails应用程序部署到Heroku。它在sqlite3上运行,我在部署它时遇到了一些问题。
首先,我确保创业板列出了正在开发中的sqlite3。这使索引页面最终正常工作,但现在当我部署它并尝试沿着链接到实际依赖于我的数据库的页面部分时,heroku errors。我盯着日志看了一会儿,不知道发生了什么事,所以我希望这里有人能知道。现在,我只发布似乎是最后一个操作的日志(沿着链接):
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
谢谢!
发布于 2012-09-13 01:09:02
Heroku使用PostgreSQL。按照Rails Tutorial Book中的说明在本地安装PostgreSQL,这样您就可以复制Heroku DB环境。Heroku itself和几乎每个教程都警告说,在sqlite3中开发,然后部署到PostgreSQL是充满危险的。
https://stackoverflow.com/questions/12398091
复制