4 PROJECT_NAME="{{ project_name }}"
5 PRODUCTION="production"
7 ################################################################################
8 # Prerequis pour le fonctionnement du script
9 ################################################################################
10 if [ ! -e "$ROOT_PATH/README.rst" ]; then
11 echo "Placez vous a la racine du projet."
16 ################################################################################
17 # Selection de la configuration
18 ################################################################################
20 if [ "$BUILD" = "" ]; then
23 REQUIREMENTS=$ROOT_PATH/requirements/$BUILD.txt
24 SETTINGS=$PROJECT_NAME.settings.$BUILD
27 ################################################################################
29 ################################################################################
30 if [ "$BUILD" = "$PRODUCTION" ]; then
31 echo "Commandes du VCS"
32 GIT_CLEAN="# On branch master
33 nothing to commit (working directory clean)"
34 GIT_STATUS=`git status`
35 if [ "$GIT_STATUS" != "$GIT_CLEAN" ]; then
36 echo "Le depot local n'est pas dans un etat acceptable pour deployer"
42 ################################################################################
43 # Tests concerant la configuration
44 ################################################################################
45 if [ ! -e "$ROOT_PATH/conf.py" ]; then
46 echo "Il n'y a pas le fichier conf.py a la racine du projet."
50 DIFF=`diff -y conf.py.edit conf.py | grep '<' | colordiff`
51 if [ "$DIFF" != "" ]; then
52 echo 'Ajuster le conf.py'
53 diff -y conf.py.edit conf.py | grep '<' | colordiff
57 ################################################################################
58 # Preparation de l'environnement
59 ################################################################################
60 VENV_PATH=$ROOT_PATH/.virtualenv
61 if [ -e "$VENV_PATH" ]; then
62 echo "l'environnement virtuel existe deja."
64 echo "Creation de l'environnement virtuel."
66 rm -f distribute*.tar.gz
69 echo "Installation des dependances."
70 echo $VENV_PATH/bin/pip
71 $VENV_PATH/bin/pip install -r $REQUIREMENTS
73 if [ "$BUILD" != "$PRODUCTION" ]; then
77 ################################################################################
78 # Preparation du projet (en production uniquement)
79 ################################################################################
80 echo "Commandes Django"
81 echo "settings: " $SETTINGS
82 $ROOT_PATH/bin/django syncdb --settings=$SETTINGS --noinput
83 $ROOT_PATH/bin/django migrate --settings=$SETTINGS --noinput
84 $ROOT_PATH/bin/django collectstatic --settings=$SETTINGS --noinput