Arctelix
Arctelix

Reputation: 4576

Django: use my FORKED version of an app in some projects, not all of them

I am very lost on how to manage my django apps. In most projects i use standerd versions of apps, but now i find myself forking projects and working on them simultaneously. How can i use my forked version in some projects and the std version in others? For example:

I have all my django projects in a directory calld DJANGOPROJECTS with a structure like this:

DJANGO PROJECTS
-PROJECT A
-PROJECT B
-APP A (forked version)
-APP B (forked version)

SITEPACKAGES (on default python path)
-APP A 
-APP B

I want to use FORKED APP A (forked version) in PROJECT A & APP A in PROJECT B. PROJECT B takes care of it's self. Now how do i make PROJECT A use FORKED APP A?

If I put APP A (forked version) in a virualenv for each project i would have to update all of them each time there was a change. If i keep it out of the virtualenv, when i make local changes to the forked app (without doing a git push) all the projects that use it will get the changes instantly.

Upvotes: 0

Views: 113

Answers (2)

Arctelix
Arctelix

Reputation: 4576

I just found a much better way. Setting up symbolic links is kind of a pain! It turns virtualenv has a built in method to do this.

Modify the path to the package you want to use for that environment in:

yourEnv/Lib/site-packages/packagename.egg.link file. 

If you are using easy-install then modify the package path in:

yourEnv/Lib/site-packages/easy-install.pth

For example:

If you want PROJECT-A to use an app called APP-A located in your github directory. Find the files noted above and modify the path from:

c:\users\someuser\documents\github\PROJECT-A\src\APP-A

to:

c:\users\someuser\documents\github\APP-A

Now PROJECT-A will use the version of APP-A in your working repository rather then the one in your virtualenv. You can now work with the APP-A repository and the changes will automatically be integrated with PROJECT-A without having to push or pull changes.

Upvotes: 0

Jesse the Game
Jesse the Game

Reputation: 2628

I solve this problem by using symbolic links to apps in my virtual environments whenever I want them to use a shared version.

Upvotes: 1

Related Questions