0

I am using multiple databases in Django,

On the current server, PostGIS is installed and am trying to connect POSTGRESQL from another server,

settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'NAME': 'db_name_1',
        'USER': 'user_name_1',
        'PASSWORD': '',
        'HOST': '',
        'PORT': '',
    },
    'users_db' : {
        'NAME' : 'db_name_2',
        'ENGINE' : 'django.db.backends.postgresql_psycopg2',
        'HOST' : '',
        'PORT' : '',
        'USER' : 'user_name_2',
        'PASSWORD' : '',
    },
    # 'users_db' : dj_database_url.config(default='postgres://user_name_2:password_2@host_2:0000/db_name_2')
}

Now as per documentation.

Error

python3 manage.py migrate --database='users_db'
AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'

UPDATE

As per other StackOverflow pages, I found dj-database-url i used it but still problem persists.

for dj-database-url

'users_db' : dj_database_url.config(default='postgres://user_name_2:password_2@host_2:0000/db_name_2')

Any help will be appreciated,

Thanks & Regards

1 Answer 1

0

You are trying to migrate geospatial enabled objects to non geospatial database...when connected another database contrib.gis.db.backend.postgis should be on the second database to only the host and ports are to change

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for the reply, they are on two different servers. So technically this problem should not come.
The error that is being displayed is when the HOST and PORT are different for both of them.
Have a look at the engine for the two database...why are you using different engines one for spatial and one for non spatial
Yes, I got your point now i have converted both the Db into PostGIS, Now its working.
Also i found this link stackoverflow.com/a/59879983/7999665 which confirms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.