Search code examples
pythondjangodirectory-structure

Django : Which approach is better [ virtualenv + pip ] vs [manually carrying packages in svn]?


I have a django project that uses a lot of 3rd party apps, so wanted to decide out of the two approaches to manage my situation :

  1. I can use [ virtualenv + pip ] along with pip freeze as requirements file to manage my project dependencies.

    I don't have to worry about the apps, but can't have that committed with my code to svn.

  2. I can have a lib folder in my svn structure and have my apps sit there and add that to sys.path
This way, my dependencies can be committed to svn, but I have to manage sys.path

Which way should I proceed ?

What are the pros and cons of each approach ?

Update:

Method1 Disadvantage : Difficult to work with appengine.


Solution

  • This has been unanswered question (at least to me) so far. There're some discussion on this recently:-

    https://plus.google.com/u/0/104537541227697934010/posts/a4kJ9e1UUqE

    Ian Bicking said this in the comment:-

    I do think we can do something that incorporates both systems. I posted a recipe for handling this earlier, for instance (I suppose I should clean it up and repost it). You can handle libraries in a very similar way in Python, while still using the tools we have to manage those libraries. You can do that, but it's not at all obvious how to do that, so people tend to rely on things like reinstalling packages at deploy time.

    http://tarekziade.wordpress.com/2012/02/10/defining-a-wsgi-app-deployment-standard/

    The first approach seem the most common among python devs. When I first started doing development in Django, it feels a bit weird since when doing PHP, it quite common to check third party lib into the project repo but as Ian Bicking said in the linked post, PHP style deployment leaves out thing such non-portable library. You don't want to package things such as mysqldb or PIL into your project which better being handled by tools like Pip or distribute.