'Pushing a project with passwords in it

I created a django project and want to share it with my team members, however in the settings files it contains some passwords for the database etc. Of course when I push it to GitHub Git Guardian tells me that I have some sensitive information such as DB credentials (username and password) and Django's Secret Key. Now, I know I basically delete those information and push it to GitHub. But I wonder if there is a more sophisticated method to push those kind of projects or a convenient way?

Thank you very much.



Solution 1:[1]

Use the decouple package, then create a .env file where you can add your passwords. Add the .env file to gitignore. Now your colleagues have to add a .env file themself and add the passwords there. Heres a good tutorial on how to do this https://dontrepeatyourself.org/post/how-to-use-python-decouple-with-django/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 grisuu