{"id":17100346,"url":"https://github.com/enriquesoria/update-django-environ-sample","last_synced_at":"2026-02-09T08:33:45.591Z","repository":{"id":63686834,"uuid":"560563857","full_name":"EnriqueSoria/update-django-environ-sample","owner":"EnriqueSoria","description":"\"Keep your env.sample up to date when using django-environ\", a tool and pre-commit hook.","archived":false,"fork":false,"pushed_at":"2022-11-02T08:08:55.000Z","size":11,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T23:53:25.978Z","etag":null,"topics":["django","django-environ","env","pre-commit","pre-commit-hook"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EnriqueSoria.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-01T19:18:16.000Z","updated_at":"2023-10-19T14:38:53.000Z","dependencies_parsed_at":"2022-11-23T23:45:25.912Z","dependency_job_id":null,"html_url":"https://github.com/EnriqueSoria/update-django-environ-sample","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnriqueSoria%2Fupdate-django-environ-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnriqueSoria%2Fupdate-django-environ-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnriqueSoria%2Fupdate-django-environ-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EnriqueSoria%2Fupdate-django-environ-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EnriqueSoria","download_url":"https://codeload.github.com/EnriqueSoria/update-django-environ-sample/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647234,"owners_count":21139082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","django-environ","env","pre-commit","pre-commit-hook"],"created_at":"2024-10-14T15:13:14.861Z","updated_at":"2026-02-09T08:33:40.570Z","avatar_url":"https://github.com/EnriqueSoria.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# update-django-environ-sample\n\nKeep your env.sample up to date when using [django-environ](https://github.com/joke2k/django-environ)\n\n## Usage\n - Put every env var with its configuration in a `ENV_DEFAULTS` variable, in a separate python file named `environment_defaults.py` (exactly this file name)\n```python\n# environment_defaults.py\nENV_DEFAULTS = dict(\n    VARIABLE_WITH_DEFAULT_VALUE=(str, \"default value\"),\n    VARIABLE_WITHOUT_DEFAULT_VALUE=str,\n)\n```\n\n - Instantiate `Env` with `ENV_DEFAULTS` on your Django settings file\n```python\n# settings.py\nfrom environ import Env\nfrom environment_defaults import ENV_DEFAULTS\n\nenv = Env(**ENV_DEFAULTS)\n```\n\n - And ensure you are accessing it using `env(\"VAR_NAME\")` instead of `env.str(\"VAR_NAME\")`\n```python\n# settings.py\nvalue = env(\"VARIABLE_WITH_DEFAULT_VALUE\")\nvalue = env(\"VARIABLE_WITHOUT_DEFAULT_VALUE\")\n```\n\n - Add this pre-commit so your `env.sample` gets updated on each commit\n```yaml\nrepos:\n  - repo: https://github.com/EnriqueSoria/update-django-environ-sample\n    rev: 'vX.X.X'  # Pick a release version\n    hooks:\n      - id: update-django-environ-sample\n        args: [ \"-p\", \"myapp/\" ]  # Path where your environment_defaults.py is located\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenriquesoria%2Fupdate-django-environ-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenriquesoria%2Fupdate-django-environ-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenriquesoria%2Fupdate-django-environ-sample/lists"}