[Fixed]-Is Git really necessary for deployment?

1👍

For some platforms, git is required for deployment. Heroku, in particular, requires git for pushing changes to a remote defined on the command heroku create. See here for more details.

In other instances, you have more options, with the caveat that you may spend a lot of time configuring a system to do so and that you may suffer from the inability to have continuous deployment without downtime.

For example, using an Amazon EC2 instance or DigitalOcean, you essentially have a bare-bones Ubuntu installation upon which you control pretty much all facets of configuration, you would be able to send files to your remote instance via SSH or using one of their clients. In this case, you would generally do the following:

  • Shut down your Django server
  • Backup your existing application and DB, just in case
  • Upload the files for your updated application
  • Run any manage.py commands for migrations and updates
  • pip install -r requirements.txt to check for updated dependencies
  • Start your server up again

As stated before, git is not required for deployment, but most Django devs would highly, highly suggest you find the root of the issue you are having with git as it helps to protect against potentially devastating problems down the line and can greatly simplify deployment when your production environment is set up correctly.

EDIT: It’s worth noting that git can provide deployment functionality when your deployment environment is set up properly, but deployment often is too complex a task to rely on git alone. A commonly used method is to use Fabric with a custom fabfile to automate deployment tasks. In tandem with git you gain version control, simplified deployment commands, and the ability to run tasks as part of your deployment.

Leave a comment