1 min readAug 2, 2020
That’s what dj_database_url
does — sets the engine, etc based on your environment variables.
I haven’t personally developed a Django app like this (sqlite + postgres) in years, since I first published the post. You may no longer need the sslmode
workaround and can remove it entirely.
Another option is to create two versions of your settings.py
— one for local development and another for production — where you set the databases explicitly.
Something like this: https://stackoverflow.com/a/15325966 is pretty common in the apps I’ve worked on.