[Answer]-Access database from a differet host in django

1👍

If you want to use the Django ORM, you can use Django’s built-in multi-database support. To create the models.py file, you can use the inspectdb management command.

If you don’t need the ORM, you can connect still specify the additional database in your settings, but only perform raw SQL queries. You need to get the right connection for your additional database:

from django.db import connections
cursor = connections['my_db_alias'].cursor()
👤sk1p

Leave a comment