MiH
MiH

Reputation: 421

How to Upload data to Heroku ? Rails 4

My Rails app is about an Online Shopping site. I'm trying Deploy it to Heroku. I've done push to heroku,and rake db:migrate.

But now in the My web,it doesn't have any Data.

In the localhost:3000,I can show Products,Phones,Users,etc. But in my web:https://boiling-bayou-5793.herokuapp.com/welcome/home

It doesn't show anything. So what should I do to upload data from my PC to my web

Upvotes: 1

Views: 83

Answers (2)

Mike Szyndel
Mike Szyndel

Reputation: 10593

A more heroku-specific method could be just loading a database dump. Assuming you're using Postgresql, n your local computer do

pg_dump -h localhost -U username -Fc dbname > db.dump

upload the file somewhere on the internet (like Amazon S3 so you can get a direct download link) and then on heroku run

heroku pgbackups:restore SHARED_DATABASE http://www.example.com/db.dump

Remember to remove the db dump right away if it's any kind of sensitive data!

Upvotes: 1

zwippie
zwippie

Reputation: 15515

The data from your local development database is not automatically transferred to the production environment. There is no rake task to do that.

You can use seed files and the rake db:seed task to get some initial data in your (production) database.

Upvotes: 3

Related Questions