6

Django & Postgres & SSL

 3 years ago
source link: https://hynek.me/articles/django-postgres-ssl/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Django & Postgres & SSL

12 April 2011

I’d thought something like this is a FAQ but the database docs on postgres don’t write a bit about forcing Django to connect using SSL to the database server.

After lots of googling (and finding hundreds of guides how to set up a Django with HTTPS) and finding out by try-and-error, behold the solution:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'dbname',
        'USER': 'dbuser',
        'PASSWORD': 'dbpassword',
        'HOST': 'dbhost',
        'OPTIONS': {
            'sslmode': 'require',
        },
    },
}

Hynek Schlawack

Hynek Schlawack

In ♥ with 🇪🇺, Python, Go, and networks. Blogger, speaker, PSF fellow, part-time beach bum.

Is my content helpful and/or enjoyable to you? Please consider supporting me! Every bit helps to motivate me in creating more. You can also buy me a coffee on Ko-fi – starting at 3 € and no account required.

If you speak German, please consider getting your domains and web hosting from my employer Variomedia. Without their support my community output would be considerably smaller.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK