Forums

Auto activate Virtual Environment

Hi

I added this code to "bashrc" : https://github.com/kennethreitz/autoenv/wiki/Cookbook

and a .env file to a test directory.

however, the virtualenv fails to activate when i cd into test directory

bashrc is only run when you start a new shell, so you probably need to start a new console after you've edited bashrc. You can also use source ~/.bashrc to activate the changes you made to your bashrc.

i tried both. still doesn't work.

Have you tried debugging it? Maybe putting some print (or "echo") statements in the script to see if it's being run? There's nothing inherently strange about PythonAnywhere that would cause a simple Bash script to not work. But the setup on that page looks quite complicated so somewhere in that script there will be an incorrect assumption or a mistake in the configuration.