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

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

问题描述

我有一个Heroku项目,使用环境变量来获取配置,但是我使用virtualenv本地测试我的应用程序。



有没有办法设置

解决方案

更新



截至2017年5月17日,自动注册表README表明, direnv 可能是更好的选择,意味着autoenv是不再维护。



旧答案



我写了autoenv来做到这一点: p>

https://github.com/kennethreitz/autoenv


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

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

解决方案

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.

Old answer

I wrote autoenv to do exactly this:

https://github.com/kennethreitz/autoenv

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

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