Connection to database

How to connect to remote exist database in Django

You can define the database in the settings.py file. It’s described here: Settings | Django documentation | Django

Also see Multiple databases | Django documentation | Django

1 Like

what if I want to connect with SSH tunnel by logging and password?

Your ssh tunnel is something outside of Django. You’d need to establish your tunnel, and then configure your connection to work through that tunnel.

1 Like

You can give more details

How can I esrablish my tunnel?

This isn’t a Django issue.

Django opens a port on a host to access a database.

If you’re creating a tunnel, that means you’re opening a port on some host that is being redirected to (possibly) a different port on (most likely) a different host.

So whatever you’re doing to create that tunnel is done outside of Django and should be established before Django starts, so that when Django starts, it can open the right port on the right host to access the database.

How do you create any ssh tunnel? Again, this isn’t a Django issue. You’ll likely find more targeted assistance by finding a more appropriate forum.

I understand, thanks for your attention