我刚刚成功部署到Heroku,但我的应用程序无法正常运行。我是否需要以某种方式迁移数据库或类似的东西?
我在本地使用postGreSQL数据库并且一切运行正常,但除了进行推送并看到它已部署之外,我在Heroku服务器上设置或迁移数据库时没有做任何其他事情,我想知道这是不是问题与否?
由于我是新手,我不知道所有必需的步骤,但我认为它应该在我推动后立即工作,但我错过了什么?
我的应用似乎是醒着并正确部署,它会对不存在的页面( - >对不起,不工作“)做出反应,对不存在的页面做反应( - >”此页面不存在“),让我相信正在阅读的页面,但需要纠正部署或数据库设置的方式。
有人可以给我一些明显的地方看,要检查的东西,或者指出我正确的方向。这是postGres的问题吗?不确定如何调试已经部署的Heroku应用程序? THX!
答案 0 :(得分:1)
你需要的是heroku run
无论如何
e.g:
heroku run rails c
Running `rails c` attached to terminal... up, run.3434
Loading production environment (Rails 4.0.0)
irb(main):001:0>
你也可以这样做:
heroku logs -t
拖尾日志
heroku help
Usage: heroku COMMAND [--app APP] [command-specific-options]
Primary help topics, type "heroku help TOPIC" for more details:
addons # manage addon resources
apps # manage apps (create, destroy)
auth # authentication (login, logout)
config # manage app config vars
domains # manage custom domains
logs # display logs for an app
ps # manage dynos (dynos, workers)
releases # manage app releases
run # run one-off commands (console, rake)
sharing # manage collaborators on an app
Additional topics:
account # manage heroku account options
certs # manage ssl endpoints for an app
db # manage the database for an app
drains # display syslog drains for an app
fork # clone an existing app
git # manage git for apps
help # list commands and display help
keys # manage authentication keys
labs # manage optional features
maintenance # manage maintenance mode for an app
pg # manage heroku-postgresql databases
pgbackups # manage backups of heroku postgresql databases
plugins # manage plugins to the heroku gem
regions # list available regions
stack # manage the stack for an app
status # check status of heroku platform
update # update the heroku client
version # display version
答案 1 :(得分:1)
您需要在heroku服务器上运行db:migrate ...
heroku run rake db:migrate