Hacker News new | ask | show | jobs
by xmatos 3897 days ago
I use git hooks for my Django deployments and it couldn't be simpler. My post-receive hook look like this:

#!/bin/sh

dest=/var/www/myproj

GIT_WORK_TREE=$dest git checkout -f

$dest/manage.py collectstatic --noinput

$dest/manage.py migrate

touch $dest/myproj/wsgi.py

Running a git push to the prod server fires this hook and that's all. I could improve it by first checking out to a test environment to run django tests and, if everything passes, do a git checkout to production.

Plus, am I the only one using apache?

2 comments

Back before WSGI really took off, mod_python made Apache fairly prolific, but most Python apps these days are using Gunicorn (or some other Python-based WSGI server), or Nginx in front of uWSGI, so yes, to some degree, you are the only one using Apache.

As a side note: I've run copious tests against Nginx -> uWSGI setups and Gunicorn, etc. setups, and Nginx -> uWSGI is in a whole different league (way faster, way more requests per second, way less memory, and you CAN (despite what I'm reading herein), very EASILY with uWSGI, deploy without losing a single request). However, I still use Gunicorn, because it's quick and easy, it works well, and I don't have to sys admin the thing.

Aren't you concerned about allowing your servers to have access to the repo?