Makefile 1.39 KB
Newer Older
Christophe Siraut's avatar
Christophe Siraut committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
clean:
	find . -name "*.pyc" -exec rm -f {} \;
	find . -name "*~" -exec rm -f {} \;
	[ ! -d media -o ! -d static -o ! -d env ] || rm -r env static media

build: clean
	[ -f flyers/settings.py ] || cp flyers/settings_example.py flyers/settings.py
	[ -d media/uploads ] || mkdir -p media/uploads
	chmod +x site.fcgi
	virtualenv env
	. env/bin/activate
	env/bin/pip install -r requirements.txt
	env/bin/python manage.py collectstatic --noinput
	env/bin/python manage.py syncdb --noinput
	#env/bin/python manage.py createsuperuser --noinput --username admin --email no@example.com
	#env/bin/python manage.py changepassword admin
	env/bin/python manage.py loaddata json/auth.json
	env/bin/python manage.py loaddata json/general.json

permissions: clean
	sudo chown -R ${USER}:www-data .
	find . -type f -exec chmod 664 {} \;
	chmod 775 manage.py site.fcgi env/bin/python

prepimages:
	find . -iname "*.jpg" -exec cp {} 1024 \;
	find . -iname "*.jpg" -exec cp {} 640 \;
	for i in 1024/*; do convert "$i" -resize 1024x1024 "$i"; done
	for i in 640/*; do convert "$i" -resize 1024x1024 "$i"; done

TESTPATH = /var/www/django-flyers

test: clean
	sudo rm -fr $(TESTPATH)
	sudo cp -r ../django-flyers $(TESTPATH)
	. $(TESTPATH)/env/bin/activate
	cd $(TESTPATH) && env/bin/python manage.py collectstatic --noinput
	sudo chown -R www-data $(TESTPATH)

kill:
	for p in $$(ps aux | grep site.fcgi | cut -f 2-3 -d' '); do sudo kill $$p; done