DSLR
DSLR copied to clipboard
Django config option
Hello, thanks for the great library!
I've been trying it out with PRs to various Django projects. It's really handy for being able to review a PR that contains a Django migration, then to flip back to a clean database for the next review.
As my Django installs already contain the database connection details, I've been thinking about an option to bootstrap Django and read from the DB settings, to save me exporting a URL or creating a TOML file.
I'd be happy to explore a PR that does this, but I wanted to check in and see if that's something you'd consider?
Thanks again
Hey!
Could you run me through an example of how this would be used? Like, what the commands would be, how would config look like, etc.
Sure. I don't know if it would be an automatic feature or not, but I see the "django config backend" as being an extra option to the DATABASE_URL
or TOML config.
You can get the Django database config by:
from django.conf import settings
settings.DATABASES
And then we could slot this option in to next_not_none
alongside the env var and toml URLs.
Or, we could add an option to the TOML file with the python path to the Django settings module. I'd need to have a bit of a play to see what the best option might be.
I don't think there would be any additional commands or features. Of course this could be an optional package, installed via dlsr[django]
if you wanted to keep Django support out of the main project.