Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why would I need to do that? I can just change the shebang line in manage.py and never ever need to activate the virtualenv...


One of the big benefits of using virtualenv is that you can change the environment your code is running within. For example, if I want to test a new version of a package (or a new version of python altogether), I can create another virtual environment and "workon [newenvname]", ./manage.py runserver..., and test away.

It also follows the principal of least surprise. As a developer, if I run a python file, I generally expect it to use the python version in my environment, not some hard coded path. This is exactly why manage.py references python in the environment (/usr/bin/_env_) and not a direct path to the python executable.

It's easy to switch virtual environments and unexpected that I'd have to change code.

I could be wrong.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: