guys. I have a database, which I deployed on Heroku.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'd7mj3h2mco40v9',
'USER': 'fwla1qyxgxrrqk',
'PASSWORD': get_secret('DB_PASSWORD'),
'HOST': 'ec2-54-174-73-136.compute-1.amazonaws.com',
'PORT': '5432',
}
}
The problem is when I add comments objects on a local machine, they automatically downloaded to the remote database. It's not convenient. I want to create, for example, a local database which will save all migrations or changes of my models, but not downloaded into a remote server. And when I need to download the data, I will do something and the changes are to appear on a remote database. What do I need to do for this? How to make the right migrations and then work with them? I'm newbie, please don't advice complicated things I can't understand :)
CodePudding user response:
Not really a newbie topic but you could look into db routers https://docs.djangoproject.com/en/4.0/topics/db/multi-db/ Simplier would be the solution detailed here https://zerotobyte.com/django-multiple-databases-setup/ as you can see you just have to add db in the settings then make migrations by specifying the chosen db.Good luck