Skip to main content

A Django package to validate environment variables given a schema of rules.

Project description

Project Description

Django env validator is a package used to validate the .env file in a Django project using a set schema of rules.

Installation

The package can be installed and used in your Django app with pip:

pip install django-env-validator

Edit your settings.py file to include ‘django_env_validator’ in the INSTALLED_APPS listing.

INSTALLED_APPS = [
    ...
    'django_env_validator',
]

Usage

Define the variable ENV_VALIDATOR_RULES in your settings.py

The current available rules are:

  • required (boolean -- is the environment variable a required one or not)
  • min_length (integer -- minimum character length of the environment variable)
  • max_length (integer -- maximum character length of the environment variable)
  • choices (list, tuple, set -- specific values the environment variable can be)

Example:

ENV_VALIDATOR_RULES = {
    "API_KEY": {
        "required": True,
        "min_length": 15,
        "max_length": 50,
    },
    "CURRENT_ENVIRONMENT": {
        "required": True,
        "choices": ["dev", "staging", "testing", "production"],
    }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_env_validator-1.0.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_env_validator-1.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file django_env_validator-1.0.1.tar.gz.

File metadata

  • Download URL: django_env_validator-1.0.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for django_env_validator-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b757d3302714a6ab2afa99fa59adf3090329ef8ad0419514217e8e4804803984
MD5 500e895422efbe279025290fa13acc89
BLAKE2b-256 69120d9f7d12e89065fbcce970c780769c5a01e7edcbb8c4ea32cfb5dabec209

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_env_validator-1.0.1.tar.gz:

Publisher: publish.yml on 72mins/django-env-validator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_env_validator-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_env_validator-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 50867c515ab6df8c297eb0888e26741d962214911b8d5e0b57aefcb5e61ddaa8
MD5 17d3e13b81cdad4c9a1b98a686b2d6c9
BLAKE2b-256 48532792790566b7193602b24dfe9c74c68188af580d2d2cd07a1f3c818852d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_env_validator-1.0.1-py3-none-any.whl:

Publisher: publish.yml on 72mins/django-env-validator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page