Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand on direnv section #1027

Open
bishop527 opened this issue Dec 17, 2019 · 0 comments
Open

Expand on direnv section #1027

bishop527 opened this issue Dec 17, 2019 · 0 comments

Comments

@bishop527
Copy link

The direnv section simply refers the reader to direnv.net for Linux installation instructions (by the the site is not linked on the page). Since there are different ways to get direnv working depending on if you're using pyenv, virtualenv, or virtualenvwrapper, it seems reasonable to direct them to the site. However, after struggling with this myself I found the instructions not straightforward, especially for a new user.
Since the direnv section directly follows the virtualenvwrapper section, I suggest updating with the following instructions to get direnv working with virtualenvwrapper:

  1. Add the following to ~/.config/direnv/direnvrc
layout_virtualenv {
    local venv_path="$1"
    source ${venv_path}/bin/activate
}
layout_virtualenvwrapper {
    local venv_path="${WORKON_HOME}/$1"
    layout_virtualenv $venv_path
}
  1. Add the following to an .envrc file in the root directory of your project
    layout virtualenvwrapper _name_of_virtual_environment_

Now, the virtual environment will activate when you enter the project directory and deactivate when you leave.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant