WebFaction
Community site: login faq

folks,

I have the directory structure like this:

webapps
|-- static_media
|-- django
      |---project A
      |---project B
      |--- .git
      |--- lib

I have two django projects A and B which are related (common apps in lib folder) and just differ by subdomain and the type of users accessing each. Currently, I maintain a git repository such that i commit files in project A and B into. However, I also have static files css and js for the projects that I forgot to include.

My question is, what is the recommended git structure here? Should I add an additional git repository for the static files? Having said that, I realize that my current repository structure is inappropriate because I will be slapping myself if I have new, independent projects in the future under django as well as css and js files for other projects.

So, really what should be the recommended git repository structure be like?

asked 19 Jun '11, 01:47

amateur
1111416
accept rate: 0%


The correct structure seems to be to have two independent repositories -- one for each of projects A and B. This is a pattern in git; the correct answer is usually to separate projects as much as possible into separate git repositories. This is in contrast to subversion where the preferred method is to have many separate projects in subdirectories of a main repository.

CSS and JS shared between your other projects should be in a separate git repository themselves. This is by the same logic as if you had created a Python library that your two Django applications use; you would want to track and update the library separately from the projects that simply import and use that library.

Having multiple git repositories doesn't increase tedium of tracking changes, because the "git" commands "just work" for whichever repository you are currently working in at the time.

That said, I would strongly suggest looking over my guide on using Git with applications for an example of how to deploy projects with git in a way that updates the main website when changes are made. In the same way, you'll have a few repositories cloned in another "working" directory, but won't have to actually modify the files in your webapps/django area directly.

So, in short, I think the most consistent and scalable approach would be to create three bare repositories each checked out to a "working" area, which use a post-receive hook to update the actual files served by the website.

permanent link

answered 19 Jun '11, 02:00

ryans ♦♦
5.0k103460
accept rate: 43%

@ryans, thank you. i suppose i should do as recommended.

(19 Jun '11, 05:20) amateur
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×111
×2

question asked: 19 Jun '11, 01:47

question was seen: 20,861 times

last updated: 19 Jun '11, 05:20

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM