Skip to content
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 for multiple databases through env variables #99

Closed
r3r00t3d opened this issue Jan 24, 2018 · 2 comments
Closed

Support for multiple databases through env variables #99

r3r00t3d opened this issue Jan 24, 2018 · 2 comments

Comments

@r3r00t3d
Copy link

Hi,

just wanted to ask what is the easiest way to interact with multiple databases via env variables? I would like to use DATABASE_URL but I cannot see an easy way to do this.

Thanks.

@r4vi
Copy link

r4vi commented Jan 25, 2018

hi @r3r00t3d by default it reads from DATABASE_URL if you would like to read from another variable just import os.environ and parse it directly:

import os, dj_database_url

DATABASES['default'] = dj_database_url.parse(os.environ['SOME_OTHER_VARIABLE'], conn_max_age=600)

@r3r00t3d
Copy link
Author

Thank you. I appreciate the answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants