Heroku - 应用程序错误
我用Ruby on Rails创建了一个简单的应用程序,我试图在Heroku上提交它。我已经按照这个Getting Started on Heroku guide, 我完成它,并尝试打开我的页面,但我仍然看到了一个错误: 应用程序错误:Heroku - 应用程序错误
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
有人知道如何处理呢?
我不知道是什么发生,但我已经做了这一步,遗憾的是我还有一个问题,我跑了几个命令:
# git add .
# git commit -m "my commit"
On branch master nothing to commit (working directory clean)
# git push heroku master Everything up-to-date
# heroku open Opening http ://eerie-meadow-9207.heroku.com/
# heroku restart Restarting processes... done
# heroku open Opening http ://eerie-meadow-9207.heroku.com/
,我看到一则消息:
We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.
从heroku logs
[为了清楚起见移除时间戳]:
app[web.1]: Started GET "/" for 77.236.11.34 at 2011-10-31 11:50:38 -0700
app[web.1]: Processing by StoreController#index as HTML
app[web.1]: Completed 500 Internal Server Error in 3ms
heroku[router]: GET eerie-meadow-9207.heroku.com/ dyno=web.1 queue=0 wait=0ms service=13ms status=500 bytes=728
heroku[nginx]: 77.236.11.34 - - [31/Oct/2011:11:50:38 -0700] "GET/HTTP/1.1" 500 728 "-" "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.2.23) Gecko/20110921 Ubuntu/10.04 (lucid) Firefox/3.6.23" eerie-meadow-9207.heroku.com
app[web.1]:
heroku[web.1]: State changed from up to bouncing
heroku[web.1]: State changed from bouncing to created
heroku[web.1]: State changed from created to starting
heroku[web.1]: Starting process with command `thin -p 40376 -e production -R /home/heroku_rack/heroku.ru start`
heroku[web.1]: Process exited
app[web.1]: >> Maximum connections set to 1024
app[web.1]: >> Listening on 0.0.0.0:40376, CTRL+C to stop
app[web.1]: >> Thin web server (v1.2.6 codename Crazy Delicious)
heroku[web.1]: State changed from starting to up
app[web.1]:
app[web.1]: Started GET "/" for 77.236.11.34 at 2011-10-31 11:50:59-0700
app[web.1]:
app[web.1]: Processing by StoreController#index as HTML
app[web.1]: Completed 500 Internal Server Error in 4ms
app[web.1]:
app[web.1]: ActiveRecord::StatementInvalid (PGError: ERROR: relation "products" does not exist
app[web.1]: : SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
app[web.1]: FROM pg_attribute a LEFT JOIN pg_attrdef d
app[web.1]: ON a.attrelid = d.adrelid AND a.attnum = d.adnum
app[web.1]: WHERE a.attrelid = '"products"'::regclass
app[web.1]: AND a.attnum > 0 AND NOT a.attisdropped
app[web.1]: ORDER BY a.attnum
app[web.1]:):
app[web.1]: app/controllers/store_controller.rb:3:in `index'
app[web.1]:
app[web.1]:
app[web.1]: cache: [GET /] miss
heroku[router]: GET eerie-meadow-9207.heroku.com/ dyno=web.1 queue=0 wait=0ms service=81ms status=500 bytes=728
heroku[nginx]: 77.236.11.34 - - [31/Oct/2011:11:50:59 -0700] "GET/HTTP/1.1" 500 728 "-" "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.2.23) Gecko/20110921 Ubuntu/10.04 (lucid) Firefox/3.6.23" eerie-meadow-9207.heroku.com
app[web.1]:
app[web.1]:
app[web.1]: Started GET "/" for 77.236.11.34 at 2011-10-31 11:54:00-0700
app[web.1]: Processing by StoreController#index as HTML
我无法理解它,因为在我的上网本上,它在localhost上工作,有什么想法?
大部分时间,heroku问题是由于缺乏访问文件系统的权限。为了让你的应用程序在heroku上工作,你必须确保它不会尝试写入任何东西到磁盘(但在临时文件夹中)。
典型的例子是js/css编译过程,例如,与指南针,你会发现他们的知识数据库上的解决方案:http://devcenter.heroku.com/articles/using-compass
你应该看看heroku日志进一步看看应用程序启动时或第一次请求期间是否有任何“权限被拒绝”的问题。
尝试用heroku restart
重新启动您的应用。假设你的应用程序在本地运行良好,这应该可以做到。它解决了我的问题,因为我只重构架构和数据库:重置似乎没有办法。
http://www.youtube.com/watch?v=p_3dIPgXgkg
如果您已经申请建造,去点上的视频时,他开始推样品应用的Heroku。不幸的是,当第一次上传3.1应用程序时,heroku很难解决错误。按照视频中的问题排查步骤操作即可。
我会尝试'heroku db:reset'然后'heroku db:migrate'如果这些命令集不起作用,请尝试'heroku destroy'并使用youtube教程重新部署教程故障排除方法 – Dru
一个解决办法:'Heroku的logs'控制台知道发生了什么 – apneadiving
你用什么堆栈? 'heroku堆栈'和哪个rails版本? –
这可能是许多事情。你看过日志还是检查了你的代码是你打算在教程中输入的内容? –