Skip to content

Instantly share code, notes, and snippets.

Created November 15, 2012 11:02
  • Star 15 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Sample Makefile for Django (use with project templates)
.PHONY: all help translate test clean update compass collect rebuild
SETTINGS={{ project_name }}.settings
TEST_SETTINGS={{ project_name }}.test_settings
# target: all - Default target. Does nothing.
@echo "Hello $(LOGNAME), nothing to do by default"
@echo "Try 'make help'"
# target: help - Display callable targets.
@egrep "^# target:" [Mm]akefile
# target: translate - calls the "makemessages" django command
cd {{ project_name }} && makemessages --settings=$(SETTINGS) -i "site-static/*" -a --no-location
# target: test - calls the "test" django command
test: test --settings=$(TEST_SETTINGS)
# target: clean - remove all ".pyc" files
clean: clean_pyc --settings=$(SETTINGS)
# target: update - install (and update) pip requirements
pip install -U -r requirements.pip
# target: compass - compass compile all scss files
cd {{ project_name }}/compass && compass compile
# target: collect - calls the "collectstatic" django command
collect: collectstatic --settings=$(SETTINGS) --noinput
# target: rebuild - clean, update, compass, collect, then rebuild all data
rebuild: clean update compass collect reset_db --settings=$(SETTINGS) --router=default --noinput syncdb --settings=$(SETTINGS) --noinput migrate --settings=$(SETTINGS) loaddata --settings=$(SETTINGS) <your fixtures here>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment