Take the 2-minute tour ×

How can I pull 3rd party Django apps into my Djano project if they require small code changes? I need to be able to:

  1. Merge upstream changes
  2. Submit pull requests for new features/mods
  3. Use the modified app in multiple projects
  4. Be able to deploy the modified app with my Django project
  5. Keep things private (optional)

Existing Semi-solutions

It seems there is much confusion on this topic. The methods I've seem proposed are:

Method# 1 - pip/virtualenv - keep project in a separate repo and add it to the python path. Advantage: clean division of code into seperate projects is probably cleaner overall, less complex Disadvantage: requires more complex management to update dependancey when developing locally.

2 - git submodule - pull the code into your Django project directory using submodules module. Advantage: seems to actually work, while subtree doesn't handle this Django app case well Disadvantage: more complicated deployment

3 - git subtree - pull the code into your Django project directory using subtree module. I explored this more myself which you can see here http://projects.madteckhead.com/django-superproject-3rd-party-git-repo-subdirectories-mapped-mapped-to-apps/ Advantage: code and history is kept with Django project, easy deployment, and reduces complexity for collaborators. Disadvantage: can't seem to 'mount' a subdirectory or a repo, into a subdirectory of the project, and if you can... I haven't been able to figure out how to merge upstream changes.

4 - copy the 3rd party app in question into the django project apps directory. Advantage: simple Disadvantage: can't easily merge changes, or submit pull requets

The problem is that Python packages actually have the app in a subdirectory of the repo. e.g. thirdpartyapp/ thirdpartyapp/setup.py thirdpartyapp/thirdpartyapp/[all the code of interest is here]


Can anyone shed light on how to best incorporate multiple 3rd party django apps into a dango peoject, make changes to them/merge upstream changes.

I'd really appreciate a clean workflow, Its been one of the MAJOR barriers for me contributing back to the apps I use in Django.

Many thanks,

share|improve this question

2 Answers 2

I'm using method# 1 (pip/virtualenv) for a while and I don't feel way to manage or develop code of 3th party applications is complex.

In the way of using full paths to external repositories of 3th party applications in requirements.txt, pip will install these application in PROJECT_ROOT/env/src/application_dir directory with all advantages of any version control system. There you can develop, pull changes to your own fork or do everything like with usual git submodules.

If you need to make changes or apply some patches to 3th party application without pulling changes to the external repos but with ability get changes on production, I can recommend you fabriclassed package. I's simple wrapper for fabric tool helping to keep you fab files organized using classes with few default tasks. For example with fabriclassed you can patch anysome of dependencies inside virtualenv directory using automatically generated *.diff files with commands:

# to dump all diffs of 3th party applications
$ fab diff_dump

# to patch all 3th party applications
$ fab patch
share|improve this answer

I am going to use git submodules. there is a great deal of advantage doing that because if you have to collaborate on an app with others that is not part of your main repo and is being heavily developed by others, you are better off. it is not that complex technically.

share|improve this answer
I'd love to hear more about how you set this up. I've tried this method, but generally find that it adds a layer of complexity, especially with tools like Hosted Chef that may require additional git authentication keys for each repo. For example how do you deploy the repo? Also, how to you keep the submodules in sync with the project repo? –  Nathan Keller Jun 27 '12 at 17:32

Your Answer


