Skip to content

Instantly share code, notes, and snippets.

@esfand
Created April 5, 2012 15:11
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esfand/2311853 to your computer and use it in GitHub Desktop.
Save esfand/2311853 to your computer and use it in GitHub Desktop.
WebFaction Deploy Apps using Git
For updating your Django (or any) application directly when you push to your git repository,
I prefer the method described at:
http://toroid.org/ams/git-website-howto
In a nutshell, you would create a post-receive hook that looks something like:
#!/bin/sh
GIT_WORK_TREE=/home/username/webapps/django/myproject git checkout -f
GIT_WORK_TREE=/home/username/webapps/django/myproject git reset --hard
Replacing "username" with your username, "django" with your django web application's name,
and "myproject" with the django project name.
You would specifically be committing the django project to git ("myproject" in this example),
and not the entire /home/username/webapps/django application directory (which includes extra
things such as the private apache server which runs your application).
The post-receive hook to update would be the file at:
/home/username/webapps/git/repos/djangorepo.git/hooks/post-receive
where "username" is your username, "git" is your git application's name, and "djangorepo.git"
is the name of the git repository you're using for your django project directory.
You will also need to ensure that the hook is executable:
chmod +x /home/username/webapps/git/repos/djangorepo.git/hooks/post-receive
Hope that helps!
I've tried now for several hours understanding how to use Git with webfaction.
And even with the documentation I cannot get it to work.
I have a Django app at: webapps/django_app/project_name/
I have a Git repo at: webapps/git_app/repos/my_repo.git
I assume the following workflow:
Make som local changes
Push it to git_app
Clone/pull to django _app from git _app.
Is this correct ? (New to git)
Problem:
How do i copy the django_app content over to my local repo?
How do I push my local changes over to git_app
How do I get the git _app files over to django _app?
Some really newbie questions there, but hope to get some help!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment