简体   繁体   English

Heroku + RoR如何在本地运行应用程序

[英]Heroku +RoR how run app locally


I'm just start working with RoR and Heroku hosting. 我刚刚开始使用RoR和Heroku托管。
I want to know how can I run application cloned from Heroku? 我想知道如何运行从Heroku克隆的应用程序?
I want to add some migration for field. 我想为字段添加一些迁移。 Can I do it right on Heroku without cloning? 我可以直接在Heroku上做而不克隆吗?

What I'm doing: 我在做什么:
1) heroku login 1) heroku login
2) git clone git..... 2) git clone git.....
3) cd cloned_app_folder 3) cd cloned_app_folder
4) bundle install 4) bundle install
5) rails g migration add_field_to_posts field:string 5) rails g migration add_field_to_posts field:string
On this stage I have many errors: like database.yml not exists and error in configuration.rb, /active_support/lazy_load_hooks.rb and other 在此阶段,我有很多错误: 不存在database.yml,而configuration.rb,/ active_support / lazy_load_hooks.rb和其他错误
6) I'm loaded db schema but it didn't help me 6) I'm loaded db schema but it didn't help me

I dont think you can do a straight migration on Heroku. 我不认为您可以在Heroku上进行直接迁移。

Check and make sure you have a database.yml in the config folder. 检查并确保在config文件夹中有一个database.yml。

If not and you are using postgres create one that looks something like this 如果没有,而您正在使用postgres,则创建一个看起来像这样的东西

development:
  adapter: postgresql
  encoding: unicode
  database: APP_NAME_development
  pool: 5
  username: COMPUTER_USER_NAME
  password:

test:
  adapter: postgresql
  encoding: unicode
  database: APP_NAME_test
  pool: 5
  username: COMPUTER_USER_NAME
  password:

production:
  adapter: postgresql
  encoding: unicode
  database: APP_NAME_production
  pool: 5
  username: COMPUTER_USER_NAME
  password:

If you already have the above, then run rake db:create and then rake db:migrate . 如果已经具备上述条件,请运行rake db:create ,然后运行rake db:migrate

Then you should be able to run your migration. 然后,您应该能够运行迁移。

Let me know if this doesn't solve the problem! 让我知道这是否不能解决问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM