Same Django project different GIT repositories
Asked Answered
F

2

8

Which is the best way to have two different repositories on the same Django project?

I started developing a project months ago and I have the whole folder in the repository. I want to reuse some apps in the project and I would like to create a different repository for them since they will be spin-offs project. But I want to keep it updated.

Which is the best workflow, methodology, etc... to achieve this? Or is it a bad approuch?

Thanks!

Xavi

Fortress answered 21/12, 2012 at 10:38 Comment(0)
S
7

You can wrap each app as a python package, which has its own GIT repo. And save all your packages in some private (or public?) python packages repository (like Gemfury).

Then, in your projects, just use the app as you install django itself.. pip install myapp

This way the apps a reusable and decoupled from any project.

(This works very well for myself.. perhaps there is a better way)

Sphene answered 21/12, 2012 at 11:47 Comment(1)
Thanks, I made some research based on your answer and this was exactly what I was looking for :O)Fortress
H
2

You can use submodule,

$git submodule add git://github.com/yourusername/project2.git project2

$cat .gitmodules

.gitmodules output:

[submodule "project2"]
  path = project2
  url = git://github.com/yourusername/project2.git

If you want to Clone some git project like submodule,

git clone git://github.com/yourusername/project2.git
cd project2
git submodule init
Hereinbefore answered 21/12, 2012 at 11:49 Comment(1)
I voted up your answer seems it explains how to do part of what I was looking for, but @Sphene answer solves exactly the question. Thanks!Fortress

© 2022 - 2024 — McMap. All rights reserved.