0

我刚刚将一个 rails 项目推送到 heroku,但是当我尝试访问该网址时,我收到“我们很抱歉,但出了点问题。” - 错误。我heroku run rake db:migrate在上传项目后就这样做了。有人知道问题可能是什么吗?

2013-07-07T03:18:40.493412+00:00 heroku[web.1]: State changed from starting to up
2013-07-07T03:19:30.121757+00:00 app[web.1]: => Booting WEBrick
2013-07-07T03:19:30.121757+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:7276
2013-07-07T03:19:30.121757+00:00 app[web.1]: => Call with -d to detach
2013-07-07T03:19:30.121757+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-07-07T03:19:30.121757+00:00 app[web.1]: Started GET "/" for 216.15.124.94 at 2013-07-07 03:19:30 +0000
2013-07-07T03:19:30.298842+00:00 app[web.1]: Processing by PagesController#lelist as HTML
2013-07-07T03:19:30.683128+00:00 app[web.1]: Completed 500 Internal Server Error in 384ms
2013-07-07T03:19:30.680391+00:00 app[web.1]:   Rendered pages/_singlePost.html.erb (39.1ms)
2013-07-07T03:19:30.687518+00:00 app[web.1]:     1: <% @posts.each do |p| %>
2013-07-07T03:19:30.682956+00:00 app[web.1]:   Rendered pages/lelist.html.erb within layouts/application (122.9ms)
2013-07-07T03:19:30.687518+00:00 app[web.1]:     3:     <div class="span6 offset3">
2013-07-07T03:19:30.687741+00:00 app[web.1]:   app/views/pages/_singlePost.html.erb:1:in `_app_views_pages__single_ost_html_erb___4229188597617574554_47615640'
2013-07-07T03:19:30.687741+00:00 app[web.1]: 
2013-07-07T03:19:30.687518+00:00 app[web.1]:     4:         <div class="thumbnail">
2013-07-07T03:19:30.687741+00:00 app[web.1]:   app/views/pages/lelist.html.erb:22:in `_app_views_pages_lelist_html_erb___4165065758361537325_47142940'
2013-07-07T03:19:30.687518+00:00 app[web.1]: LINE 1: SELECT  "posts".* FROM "posts"  WHERE (DATETIME(created_at) ...
2013-07-07T03:19:30.687518+00:00 app[web.1]: : SELECT  "posts".* FROM "posts"  WHERE (DATETIME(created_at) <= DATETIME('2013-07-07 03:19:30.364173')) ORDER BY created_at DESC LIMIT 10 OFFSET 0):
2013-07-07T03:19:30.687518+00:00 app[web.1]: HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
2013-07-07T03:19:30.687741+00:00 app[web.1]: 
2013-07-07T03:19:30.687518+00:00 app[web.1]: 
2013-07-07T03:19:30.687518+00:00 app[web.1]: ActionView::Template::Error (PGError: ERROR:  function datetime(timestamp without time zone) does not exist
2013-07-07T03:19:30.687518+00:00 app[web.1]:     2: <div class="row">

在日志中再往下一点,我得到另一个错误:

2013-07-07T03:35:54.804738+00:00 app[web.1]: ActionView::Template::Error (PGError: ERROR:  function datetime(timestamp without time zone) does not exist
2013-07-07T03:35:54.804738+00:00 app[web.1]: LINE 1: SELECT  "posts".* FROM "posts"  WHERE (DATETIME(created_at) ...
2013-07-07T03:35:54.804738+00:00 app[web.1]:                                                ^
2013-07-07T03:35:54.804738+00:00 app[web.1]: HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
2013-07-07T03:35:54.804738+00:00 app[web.1]: : SELECT  "posts".* FROM "posts"  WHERE (DATETIME(created_at) <= DATETIME('2013-07-07 03:35:54.572183')) ORDER BY created_at DESC LIMIT 10 OFFSET 0):
2013-07-07T03:35:54.804738+00:00 app[web.1]:     1: <% @posts.each do |p| %>
2013-07-07T03:35:54.804738+00:00 app[web.1]:     4:         <div class="thumbnail">
2013-07-07T03:35:54.804738+00:00 app[web.1]:     2: <div class="row">
2013-07-07T03:35:54.804738+00:00 app[web.1]:     3:     <div class="span6 offset3">
2013-07-07T03:35:54.804934+00:00 app[web.1]:   app/views/pages/_singlePost.html.erb:1:in `_app_views_pages__single_ost_html_erb___4229188597617574554_47615640'
2013-07-07T03:35:54.804934+00:00 app[web.1]:   app/views/pages/lelist.html.erb:22:in `_app_views_pages_lelist_html_erb___4165065758361537325_47142940'
4

1 回答 1

2

Heroku 使用 postgresql 作为您的数据库。 DATETIME 不是 postgres 支持的函数。您应该在您的开发环境中设置一个相同版本的 postgresql 数据库。你在什么操作系统上?如果是 Windows,我为此写了任何答案(即使您正在运行 linux,其中一些也适用)。

于 2013-07-07T22:37:01.257 回答