0

I'm using two database instances in Django, one is in Postgis and the other is in Postgres itself. Postgis is a geospatial database that has some model fields and features that the PostgreSQL database which is its extender does not have.

When I run the ./manage.py migrate, to avoid tracebacks, I want the migrations related to Postgis migrate to Postgis and the ones related to Postgres migrated to Postgres which is the default database.

I could do this by specifying --database="postgis" while running the migration command but it would be best option to avoid doing that.

DeeStarks
  • 320
  • 5
  • 16
  • 1
    Why do you need separate databases? Why not use a single Postgres database with the postgis extension installed? – Iain Shelvington Jun 29 '21 at 00:36
  • The project was started off using Postgres, and there has been issues moving the data into Postgis. So I had to stick to using Postgres as the default database to avoid messing with the data. Probably, it would be changed in the future but for now I need to figure that out. – DeeStarks Jun 29 '21 at 11:18
  • @DeeStarks are the models in different apps inside the project? – John Moutafis Nov 15 '21 at 13:41

1 Answers1

0

if you have two projects you have to change in settings file.. 1st project use one db and for second one use another db.You shoud need to change the settings file accordingly if you are using two projects.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME':  'db1',
        'USER': 'root',
        'PASSWORD': '',
        'HOST': 'localhost',
        'PORT': '3306',
    }
}
sreekanth
  • 11
  • 4