在 virtualenv 中设置环境变量 [英] setting an environment variable in virtualenv

查看:46
本文介绍了在 virtualenv 中设置环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Heroku 项目,它使用环境变量来获取其配置,但我首先使用 virtualenv 在本地测试我的应用程序.

I have a Heroku project that uses environment variables to get its configuration, but I use virtualenv to test my app locally first.

有没有办法在virtualenv里面设置远程机器上定义的环境变量?

Is there a way to set the environment variables defined on the remote machine inside virtualenv?

推荐答案

更新

截至 2017 年 5 月 17 日,autoenv 的自述文件指出 direnv 可能是更好的选择并暗示 autoenv不再维护.

Update

As of 17th May 2017 the README of autoenv states that direnv is probably the better option and implies autoenv is no longer maintained.

我写了 autoenv 来做到这一点:

I wrote autoenv to do exactly this:

https://github.com/kennethreitz/autoenv

这篇关于在 virtualenv 中设置环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆