New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support database URLs #307
Comments
For Django there is DATABASES = {
"default": env.db(), # here DATABASE_URL variable is looked up in environment variables
}
# or
DATABASES = {
"default": {
"NAME": env("DB_NAME"),
"USER:" env("DB_USER"),
# ...
}
} |
I like the first option but it has the downside to make it difficult to add other parameters such as : DATABASES = {
"mysql": {
"prefix": "",
"grammar": "mysql",
"options": {
"charset": "utf8mb4",
},
}
} |
About the ideas: In django we set the "default" key to define all data in dictionary from connection. DATABASES = {
"default": database_url(env("DATABASE_URL")) # mysql/sqlite/postgres
} |
Yes django-environ is using dj-database-url internally ;) |
Hm maybe we can have a. mix then. I see the benefits of having both |
I have give it a try, let me know what you think ! |
We should be able to somehow support database URL's
postgres://user:secret@localhost:5432/mydatabasename
We should be able to discuss the best way to approach this. Maybe we either have a function that returns the information in a correct format like:
Maybe this returns a dictionary.
Another option is maybe just adding a URL attribute, and if it exists, use that instead of all the other config options:
If
url
is set, use that, if not then don't use it?Open for discussion. Can see how other libraries do this
The text was updated successfully, but these errors were encountered: