I’m currently developing several websites on Django, which requiere several Django Apps. Lets say I have two Django projects: web1 and web2 (the websites, each has a git repo). Both web1 and web2 have a different list of installed apps, but happen to both use one (or more) application(s) developed by me, say “MyApp” (also has a git repo there). My questions are:
-
What is the best way to decouple MyApp from any particular website? What I want is to develop MyApp independently, but have each website use the latest version of the app (if it has it installed, of course). I have two “proposed” solutions: use symlinks on each website to a “master” MyApp folder, or use git to push from MyApp to each website’s repo.
-
How to deploy with this setup? Right now, I can push the git repo of web1 and web2 to a remote repo in my shared hosting account, and it works like a charm. Will this scale adequately?
I think I have the general idea working in my head, but I’m not sure about the specifics. Won’t this create a nested git repo issue? How does git deal with simlinks, specifically if the symlink destination has a .git folder in it?
The way I work:
Each website has it’s own git repo and each app has it’s own repo. Each website also has it’s own
virtualenvandrequirements.txt. Even though 2 websites may share the most recent version of MyApp right now, they may not in the future (maybe you haven’t gotten one of the websites up to date on some API changes).If you really must have just one version of MyApp, you could install it at the system level and then symlink it into the
virtualenvfor each project.For development on a local machine (not production) I do it a little differently. I symlink the app’s project folder into a “src” folder in the
virtualenvof the website and then to apython setup.py developinto thevirtualenvso that the newest changes are always used on the website “in real time”.