My problem with virtualenv is solved. Great thanks to Malcolm Tredinnick for taking the time to understand it and pushing me into the right direction.
As I said in the previous post, I didn't really need the isolation feature of virtualenv with my single-user, single-codebase site. What I really needed was pip. But I was ready to live with virtualenv if needed, just wasn't quite happy with the amount of machinery required to make my code see and use it.
Apparently what I was missing was PEP 370. Modern Pythons now have a special place for local user packages. And the good thing is that pip knows how to use it. Which is exactly what I needed.
To summarize:
- I don't use virtualenv to run my site from.
- I
pip install --user
everything non-system into the local site-packages. - I also symlink all my own local code into the local site-packages.
- I got rid of all the modifications in manage.py and wsgi.py.
All in all, I'm very glad that I had a chance to play and understand virtualenv (and related things like virtualenvwrapper). Coincidentally, it was recently accepted to Python core. Congratulations!
Comments: 2
That's quite interesting. I think there should be a better solution — I mean, amount of bookkeeping with symbolic links would throw be back to using virtualenv. Does python setup.py develop work with PEP-370?
Uhm… There's no bookkeeping at all. If I had to run some command just to install (effectively, just copy) my own code from the checkout directory into site-packages — that would be bookkeeping. Now I just update my code and restart the site, that's it.