How to create ssl connection between django and postgresql

Edit the settings.py file like this:

DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# },
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': 'server-ip',
'PORT': '5432',
'NAME': 'database-name',
'USER': 'username',
'PASSWORD': 'password',
'OPTIONS': {
'sslmode': 'require',
'sslcert': '/path/to/file',
'sslkey': '/path/to/file',
'sslrootcert': '/path/to/file',
},
},
}

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response