Skip to content

feat: Implement python-decouple for environment variables management #187

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

smkbarbosa
Copy link

This pull request introduces the use of python-decouple to manage the environment variables of the Django-CRM project. It also updates the installation and configuration documentation to reflect this change.

Motivation:

  • Security: Storing sensitive information (such as API keys, database credentials) outside the source code, in a .env file, increases the security of the project.

  • Flexibility: Makes it easier to configure the project in different environments (development, testing, production) without changing the code.

  • Organization: Centralizes the configurations in a .env file, making management simpler and more organized.

  • Consistency: Ensures that environment variables are loaded consistently across all environments.

Change Details:

  1. Installation of python-decouple:
  • Added python-decouple to requirements.txt.
  • Instructions for installing dependencies have been updated in the documentation.
  1. Creation of the .env File:
  • Added a sample .env file (contrib/env-sample) to serve as a template.
  • Instructions for creating and configuring the .env file have been added to the documentation.
  1. Modification of settings.py:
  • The webcrm/settings.py file has been updated to use python-decouple to read environment variables.
  • Examples of how to use config() have been added to the documentation.
  1. .gitignore:
  • Added .env to .gitignore to prevent sensitive information from being sent to the repository.
  1. Documentation:
  • The "Settings of Django CRM" section has been updated with a new subsection "Environment Variables and python-decouple".
  • Detailed instructions on how to set environment variables have been added.
  • Explanations on the benefits of using environment variables have been included.
  • Information on how to use dj-database-url has been added to make database configuration easier.

Impact:

  • The project is now more secure, since sensitive information is no longer in the code.
  • The project configuration is more flexible and organized.
  • It makes it easier for new developers to contribute to the project.

Testing:

Local testing has been performed to ensure that the project works correctly with the new settings.

  • The documentation has been revised for clarity and accuracy.

Checklist:

  • python-decouple installed and configured.
  • .env file created and configured.
  • settings.py updated to use python-decouple.
  • .env added to .gitignore.
  • Documentation updated.
  • Local testing performed.
  • dj-database-url installed and configured.

@DjangoCRM DjangoCRM added enhancement New feature or request needs review Pull requests that require code review and approval labels Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs review Pull requests that require code review and approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants