ruby-on-rails Heroku展开问题

oxcyiej7  于 2023-01-14  发布在  Ruby
关注(0)|答案(6)|浏览(152)

我正在学习本教程,并且已经按照步骤部署到Heroku
当我从Heroku打开应用程序时,得到的结果如下:
黑六|欢迎使用您的新应用!
为什么我的申请没有显示?

**编辑:**这是运行heroku logs时得到的结果:

$ heroku logs
←[36m2011-07-29T18:08:11+00:00 heroku[api]:←[0m Add-on add logging:basic by xyz@xyz.com
←[36m2011-07-29T18:08:11+00:00 heroku[api]:←[0m Release v1 created by xyz@xyz.com
←[36m2011-07-29T18:08:13+00:00 heroku[api]:←[0m Add-on update shared-database
←[36m2011-07-29T18:08:13+00:00 heroku[api]:←[0m Release v3 created by xyz@xyz.com
←[33m2011-07-29T18:08:45+00:00 heroku[slugc]:←[0m Slug compilation started
←[36m2011-07-29T18:09:37+00:00 heroku[api]:←[0m Deploy e04b0d1 by xyz@xyz.com
←[36m2011-07-29T18:09:37+00:00 heroku[api]:←[0m Release v4 created by xyz@xyz.com
←[32m2011-07-29T18:09:39+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[33m2011-07-29T18:09:40+00:00 heroku[slugc]:←[0m Slug compilation finished
←[32m2011-07-29T18:09:41+00:00 heroku[web.1]:←[0m Starting process with command
`thin -p 59785 -e production -R /home/heroku_rack/heroku.ru start`
←[32m2011-07-29T18:09:44+00:00 app[web.1]:←[0m >> Maximum connections set to 102
4
←[32m2011-07-29T18:09:44+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
me Crazy Delicious)
←[32m2011-07-29T18:09:44+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:59785, CT
RL+C to stop
←[32m2011-07-29T18:09:45+00:00 heroku[web.1]:←[0m State changed from starting to
 up
←[35m2011-07-29T18:10:08+00:00 heroku[rake.1]:←[0m State changed from created to
 starting
←[35m2011-07-29T18:10:10+00:00 app[rake.1]:←[0m Awaiting client
←[35m2011-07-29T18:10:11+00:00 heroku[rake.1]:←[0m State changed from starting t
o up
←[35m2011-07-29T18:10:11+00:00 heroku[rake.1]:←[0m Process exited
←[35m2011-07-29T18:10:12+00:00 heroku[rake.1]:←[0m State changed from up to comp
lete
←[33m2011-07-29T18:13:55+00:00 heroku[slugc]:←[0m Slug compilation started
←[36m2011-07-29T18:14:52+00:00 heroku[api]:←[0m Deploy dbed18f by xyz@xyz.com
←[36m2011-07-29T18:14:52+00:00 heroku[api]:←[0m Release v5 created by xyz@xyz.com
←[32m2011-07-29T18:14:52+00:00 heroku[web.1]:←[0m State changed from up to bounc
ing
←[32m2011-07-29T18:14:52+00:00 heroku[web.1]:←[0m State changed from bouncing to
 created
←[32m2011-07-29T18:14:52+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[33m2011-07-29T18:14:53+00:00 heroku[slugc]:←[0m Slug compilation finished
←[32m2011-07-29T18:14:54+00:00 heroku[web.1]:←[0m Stopping process with SIGTERM
←[32m2011-07-29T18:14:54+00:00 app[web.1]:←[0m >> Stopping ...
←[32m2011-07-29T18:14:55+00:00 heroku[web.1]:←[0m Process exited
←[32m2011-07-29T18:14:55+00:00 heroku[web.1]:←[0m Starting process with command
`thin -p 49961 -e production -R /home/heroku_rack/heroku.ru start`
←[32m2011-07-29T18:14:58+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
me Crazy Delicious)
←[32m2011-07-29T18:14:58+00:00 app[web.1]:←[0m >> Maximum connections set to 102
4
←[32m2011-07-29T18:14:58+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:49961, CT
RL+C to stop
←[32m2011-07-29T18:14:59+00:00 heroku[web.1]:←[0m State changed from starting to
 up
←[35m2011-07-29T18:15:21+00:00 heroku[rake.2]:←[0m State changed from created to
 starting
←[35m2011-07-29T18:15:24+00:00 heroku[rake.2]:←[0m State changed from starting t
o up
←[35m2011-07-29T18:15:25+00:00 heroku[rake.2]:←[0m State changed from up to comp
lete
←[32m2011-07-29T18:17:47+00:00 app[web.1]:←[0m
←[32m2011-07-29T18:17:47+00:00 app[web.1]:←[0m
←[32m2011-07-29T18:17:47+00:00 app[web.1]:←[0m Started GET "/use
←[31m←[0m
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m   Processing by UsersController#i
ndex as HTML
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m Completed 500 Internal Server Err
or in 61ms
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m ActiveRecord::StatementInvalid (P
GError: ERROR:  relation "users" does not exist
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m : SELECT "users".* FROM "users"):

←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m   app/controllers/users_controlle
r.rb:5:in `index'
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m
←[32m2011-07-29T18:17:48+00:00 app[web.1]:←[0m
←[32m2011-07-29T19:18:57+00:00 heroku[web.1]:←[0m Idling
←[32m2011-07-29T19:18:58+00:00 heroku[web.1]:←[0m State changed from up to down
←[32m2011-07-29T19:18:58+00:00 heroku[web.1]:←[0m Stopping process with SIGTERM
←[32m2011-07-29T19:18:58+00:00 app[web.1]:←[0m >> Stopping ...
←[32m2011-07-29T19:18:59+00:00 heroku[web.1]:←[0m Process exited
←[35m2011-08-02T07:38:42+00:00 heroku[rake.1]:←[0m State changed from created to
 starting
←[35m2011-08-02T07:38:44+00:00 app[rake.1]:←[0m Awaiting client
←[35m2011-08-02T07:38:45+00:00 app[rake.1]:←[0m Starting process with command `r
ake db:migrate`
←[35m2011-08-02T07:38:45+00:00 heroku[rake.1]:←[0m State changed from starting t
o up
←[35m2011-08-02T07:38:45+00:00 heroku[rake.1]:←[0m Process exited
←[35m2011-08-02T07:38:46+00:00 heroku[rake.1]:←[0m State changed from up to comp
lete
←[33m2011-08-02T07:58:10+00:00 heroku[slugc]:←[0m Slug compilation started
←[36m2011-08-02T07:59:08+00:00 heroku[api]:←[0m Deploy e5db406 by xyz@xyz.com
←[36m2011-08-02T07:59:08+00:00 heroku[api]:←[0m Release v6 created by xyz@xyz.com
←[33m2011-08-02T07:59:11+00:00 heroku[slugc]:←[0m Slug compilation finished
←[35m2011-08-02T07:59:44+00:00 heroku[rake.2]:←[0m State changed from created to
 starting
←[35m2011-08-02T07:59:46+00:00 app[rake.2]:←[0m Awaiting client
←[35m2011-08-02T07:59:46+00:00 app[rake.2]:←[0m Starting process with command `r
ake db:migrate`
←[35m2011-08-02T07:59:47+00:00 heroku[rake.2]:←[0m State changed from starting t
o up
←[35m2011-08-02T07:59:48+00:00 heroku[rake.2]:←[0m Process exited
←[35m2011-08-02T07:59:49+00:00 heroku[rake.2]:←[0m State changed from up to comp
lete
←[32m2011-08-02T08:00:27+00:00 heroku[web.1]:←[0m Unidling
←[32m2011-08-02T08:00:27+00:00 heroku[web.1]:←[0m State changed from down to cre
ated
←[32m2011-08-02T08:00:27+00:00 heroku[web.1]:←[0m State changed from created to
starting
←[32m2011-08-02T08:00:29+00:00 heroku[web.1]:←[0m Starting process with command
`thin -p 12972 -e production -R /home/heroku_rack/heroku.ru start`
←[32m2011-08-02T08:00:32+00:00 app[web.1]:←[0m >> Thin web server (v1.2.6 codena
me Crazy Delicious)
←[32m2011-08-02T08:00:32+00:00 app[web.1]:←[0m >> Maximum connections set to 102
4
←[32m2011-08-02T08:00:32+00:00 app[web.1]:←[0m >> Listening on 0.0.0.0:12972, CT
RL+C to stop
←[32m2011-08-02T08:00:32+00:00 heroku[web.1]:←[0m State changed from starting to
 up
←[32m2011-08-02T09:01:44+00:00 heroku[web.1]:←[0m Idling
←[32m2011-08-02T09:01:45+00:00 heroku[web.1]:←[0m State changed from up to down
←[32m2011-08-02T09:01:46+00:00 heroku[web.1]:←[0m Stopping process with SIGTERM
←[32m2011-08-02T09:01:46+00:00 app[web.1]:←[0m >> Stopping ...
←[32m2011-08-02T09:01:46+00:00 heroku[web.1]:←[0m Process exited

谢谢。

ubof19bj

ubof19bj1#

从日志中看,您似乎尚未迁移数据库,因为它正在查找表users。若要迁移,请在“heroku rake db:migrate VERSION=0”中键入以下内容,然后键入“heroku rake db:migrate”。请在heroku文档中查看此处
http://devcenter.heroku.com/articles/database
在“迁移到PostgreSQL的常见问题”部分。也可以查看这个
http://devcenter.heroku.com/articles/using-the-cli
,用于所有可以从终端运行的命令。由于您使用的是heroku,请尝试将本地数据库也设置为postgresql,这将在以后解决一些小问题。请记住,每次将文件推送到heroku时,如果您的数据库结构发生了更改,则需要迁移数据库。

zsohkypk

zsohkypk2#

您可以使用:

heroku logs

以查看服务器上当前发生的情况。

vaj7vani

vaj7vani3#

我认为最简单的方法是重新开始,进入应用的根目录,比如myapp,然后删除git repo。

cd sites
cd myApp
git rm -r .git

然后登录Heroku并在CMS中销毁你的应用,然后创建一个新的heroku rails应用,方法是进入你的目录,创建一个新的repo,添加你的目录,提交为master,创建一个heroku应用,然后推送到heroku。

git init
git add .
git commit -m 'master'

heroku create
heroku rename myApp
git push heroku master

然后,您将需要运行迁移。

heroku rake db:migrate

如果您想将数据从本地机器推送到生产环境中,您将需要使用tap gem,但要确保将其添加到您的包中。

gem 'taps'

然后再次运行bundle。

bundle

然后,如果需要,您可以推送本地数据。

heroku db:push
gc0ot86w

gc0ot86w4#

有点晚了,但是我遇到了这个问题。我的宝石档案里少了福尔曼

z8dt9xmd

z8dt9xmd5#

如果您正在访问www.example.com,请在Gemfile中注解掉sqlite 3(#gem 'sqlite3')railstutorial.org comment out sqlite 3 (#gem 'sqlite3') in the Gemfile
然后:

git add .

git commit -am "fix heroku"

git push heroku
shstlldc

shstlldc6#

试试这个,删除你的package.json然后npm init.删除你在Heroku中现有的应用程序,用新的package.json推回应用程序。

相关问题