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 nothing to commit (working directory clean)"
33 GIT_STATUS=`git status`
34 if [ "$GIT_STATUS" != "$GIT_CLEAN" ]; then
35 echo "Le depot local n'est pas dans un etat acceptable pour deployer"
41 ################################################################################
42 # Tests concerant la configuration
43 ################################################################################
44 if [ ! -e "$ROOT_PATH/conf.py" ]; then
45 echo "Il n'y a pas le fichier conf.py a la racine du projet."
49 DIFF=`diff -y conf.py.edit conf.py | grep '<' | colordiff`
50 if [ "$DIFF" != "" ]; then
51 echo 'Ajuster le conf.py'
52 diff -y conf.py.edit conf.py | grep '<' | colordiff
56 ################################################################################
57 # Preparation de l'environnement
58 ################################################################################
59 VENV_PATH=$ROOT_PATH/.virtualenv
60 if [ -e "$VENV_PATH" ]; then
61 echo "l'environnement virtuel existe deja."
63 echo "Creation de l'environnement virtuel."
65 rm -f distribute*.tar.gz
68 echo "Installation des dependances."
69 echo $VENV_PATH/bin/pip
70 $VENV_PATH/bin/pip install -r $REQUIREMENTS
72 if [ "$BUILD" != "$PRODUCTION" ]; then
76 ################################################################################
77 # Preparation du projet (en production uniquement)
78 ################################################################################
79 echo "Commandes Django"
80 echo "settings: " $SETTINGS
81 $ROOT_PATH/bin/django syncdb --settings=$SETTINGS --noinput
82 $ROOT_PATH/bin/django migrate --settings=$SETTINGS --noinput
83 $ROOT_PATH/bin/django collectstatic --settings=$SETTINGS --noinput