user805981
user805981

Reputation: 11049

How to configure development and deployment database for heroku?

I started playing around with Heroku today. I'm a bit confused on how to set up my development environment vs deployment.

I'm working on a django app. Not RoR haha.

Should I use a mysql database for development and postgres for deployment? Or should I keep them both postgres? What should I keep in mind?

Are there any tricks or tips for deploying database configurations and running local tests?

Thanks :)

Upvotes: 1

Views: 261

Answers (3)

catsby
catsby

Reputation: 11342

Heroku recommends using the same setup locally as much as possible: https://devcenter.heroku.com/articles/heroku-postgresql#local-setup

As much as ORMs abstract much of the details away, it's still a good idea to have dev/production parity, and will help when you want to download a pg_dump of your production app for use locally.

Upvotes: 1

jordelver
jordelver

Reputation: 8432

I would argue that you should try and use the same database for development as you do for production. They are not necessarily interchangeable. However, I have been known to ignore this rule myself due to the pure convenience of sqlite ;)

Upvotes: 1

Prakash Murthy
Prakash Murthy

Reputation: 13067

You can do either way. Either have mysql/sqlite for dev & postgres for prod, or have postgres for both. Depends on what you are comfortable with.

Only thing to ensure is to separate the related gems required for dev & prod.

Partial content of Gemfile when mysql is used for dev & postgres for prod:

group :production do
  gem 'pg', '0.11.0'
end

group :development, :test do
  gem 'mysql', '2.8.1'
  # gem 'sqlite3-ruby', :require => 'sqlite3'
end

Upvotes: 1

Related Questions