|
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:
Is this correct ? (New to git) Problem:
Some really newbie questions there, but hope to get some help! |
|
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:
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:
Hope that helps! Another point of interest: You can "template-ify" your settings file. So, for example, if you have this running locally (with a different settings file), just make something like "settings_template.py" which is added to your git repository, and then add "settings.py" into your .gitignore file (and don't add "settings.py" to the repository). Now, you can instantly share the same django project between your local and remote systems without worrying about blowing away each side's respective settings files, and at the same time still be able to use the automatic update-on-push post-receive hook. I know I am way late on this, but this topic interests me. However, I am a little confused by what you mean when you say "template-ify". What exactly would be using the settings_template.py? Nothing would be using The Now, imagine that we just add So, instead, we add UPDATE I now have changed my workflow a bit and find that the following works a bit better. I leave '
Then, define the deployment-specific options in ' This allows actual configuration options (like Why do you add I have added this so that if you delete a file in the origin git repository, it is likewise deleted in the application directory on the webfaction server. I remember that originally I had encountered an issue where under certain circumstances extra files would be left around, and performing the If you're prompted for a password when pushing or pulling over SSH, you can fix that by setting up a SSH keypair to use for authentication. The steps are almost identical to those in our SSH key documentation but with one difference: both steps should be run while logged into SSH on your WebFaction server.
showing 5 of 6
show all
|
|
Our official documentation on GIT is here,
You should be able to simply push and pull your code using SSH. This section specifically should answer your questions with examples,
|