Search code examples
pythondjangogitdeploymentproduction

Deploying with git


Currently I have a bunch of git repos for a django site i'm looking to deploy, the repos' take the form:

sn-static
sn-django
sn-templates
[etc]

I then have a super repos that stores each of these as a submodules. In terms of deployment, I want to try to keep things fairly simple, would it be a valid method to:

  • Clone a stable tag from the super repos & therefore have stable clones of each repos in one place.
  • As the names are sn-* I would then look the symlink to a more friendly structure e.g. ln -s /path/to/super-repos/sn-static /home/site/media/
  • Then my nginx webserver (in the case of static content at least) could simply refer to /home/site/media

Without a great deal of technical knowledge i'm unsure if symlinking would have any implications, in terms of speed or stability. I'm also wondering if I can get away with this as a method of deployment, rather than, say, using something like Capistrano (that as yet I have no experience with).


Solution

  • An option you should consider is using pip in conjunction with virtualenv to install your packages especially as pip has the option to directly install certain branches or tags from a git repository. That way you can use one requirements file to handle all your dependencies, your own packages and apps by other people. (See this post for the big picture.)

    And to handle your static media I'd prefer to use Django's builtin staticfiles app instead of symlinking several dirs, as it seems cleaner and easier to manage.