Home > Software engineering >  App deployed on Heroku doesn't show data from MySql DB
App deployed on Heroku doesn't show data from MySql DB

Time:01-25

On development, I set up a clever cloud MySQL database to my Django project with these settings:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'db-name',
        'HOST': 'db-name-mysql.services.clever-cloud.com',
        'PORT': 3306,
        'PASSWORD': 'password',
        'USER': 'user'
    }
}

It worked normally, so I created some data on this DB for testing.

I deployed this app on Heroku, and when I successfully deploy it, I realized that the data shown on Heroku, is not the same as my clever cloud DB. I don't know if Heroku is using another database or why is not using my database.

CodePudding user response:

Clever Cloud and Heroku are two different services. I don't think you can use the database from one in the other, nor do I understand why you would. Why not use Clever Cloud for both, keep your database and deploy your app to Clever Cloud? To deploy to Clever Cloud, take a look at their docs.

Now if you want to deploy your app to Heroku, your best bet is to migrate to postgres since that is the native database for Heroku. But you can use MySQL on Heroku if you wish. For that you can use an addon that Heroku provides, ClearDB MySQL addon from Heroku.

  •  Tags:  
  • Related