Sunday, June 28, 2020

Error in Connecting Multiple Database Django ( 'DatabaseOperations' object has no attribute 'geo_db_type' )

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**
```python
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**
```bash
python3 manage.py migrate --database='users_db'
```
```python
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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9103d03c-9022-458f-bfe5-164161102588o%40googlegroups.com.

No comments:

Post a Comment