问题标签 [django-stubs]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
23 浏览

python - 如何让 .env 预先提交 + mypy + django-stubs

我尝试在提交之前配置 start mypy + django-stubs cheking。我使用预先提交。当我尝试提交时,出现错误django.core.exceptions.ImproperlyConfigured: Set the POSTGRES_DB environment variable。这个变量在 .env 文件中,我使用 django-environ 将变量从 .env 导出到 Django 配置。当然还有 .gitignore 中的 .env。所以,据我了解:预提交从它自己的虚拟环境开始,它不知道我的 .env 文件。

最重要的是,我是否正确理解我的情况?如果我是对的,如何从 .env 文件中获取变量以预先提交环境?

我的.pre-commit-config.yaml(部分)

我的setup.cfg