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

Try loading environment variables from .env to fetch settings module #15

Closed

Conversation

it-is-wednesday
Copy link

Hello, thanks for the wonderful project:)

I had a problem using the find-* functions because they could not find my project's settings module. When running the project itself, I use python-dotenv to set the DJANGO_SETTINGS_MODULE environment variable, and thus tell Django where the settings module is.

This PR makes djangonaut pick up the .env file on every command. It adds a minor unfelt overhead to every command, but I would understand if you wouldn't appreciate it, so I want to bring this up for discussion: do you use this workflow? if no, then how do you separate between production and development environments?

Another possible solution is to add a djangonaut-dotenv-p boolean variable, which will toggle this behaviour.

What do you think?

@it-is-wednesday
Copy link
Author

My bad, I completely missed this part in the README: https://github.com/pythonic-emacs/djangonaut?tab=readme-ov-file#settings-module

I'll leave the PR open in case you may find the dotenv workflow worthy of supporting

@dakra
Copy link
Member

dakra commented Oct 13, 2024

Hi!
Thanks for the PR and comment.
I think I would rather not include something tool specific, otherwise we could end up with multiple implementations for different env tools in our code that we have to maintain (e.g. unlikely, but if dotenv.load_dotenv() upstream doesn't do what it's supposed to anymore).

That said I currently don't use Python/Django anymore, so if you feel strongly about it, I could bew convinced to include it.

Closing it for now but feel free to make an argument for inclusion.

Thanks

@dakra dakra closed this Oct 13, 2024
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

Successfully merging this pull request may close these issues.

2 participants