Déploiement

This commit is contained in:
root 2018-03-11 23:28:32 +01:00
parent be45b37ed4
commit 1392d7cef2
2 changed files with 10 additions and 7 deletions

View file

@ -2,23 +2,24 @@
PYTHON_INTERPRETER = "/usr/bin/python3" PYTHON_INTERPRETER = "/usr/bin/python3"
printf "\033[0;32m > Installation de MySQL \033[0m\n" printf "\033[0;32m > Installation de MySQL \033[0m\n"
apt-get -y install python3-mysqldb mysql-client mysql-server apt-get -y install mysql-client mysql-server
printf "\033[0;32m > Installation de Apache \033[0m\n" printf "\033[0;32m > Installation de Apache \033[0m\n"
apt-get -y install apache2 libapache2-mod-wsgi-py3 apt-get -y install apache2 libapache2-mod-wsgi-py3
a2enmod ssl a2enmod ssl
a2enmod wsgi a2enmod wsgi
printf "\033[0;32m > Installation de Python3 et pip \033[0m\n" printf "\033[0;32m > Installation de Python3 et pip \033[0m\n"
apt-get -y install python3 python3-pip apt-get -y install python3 python3-pip
pip3 install virtualenv
printf "\033[0;32m > Création du virtualenv \033[0m\n" printf "\033[0;32m > Création du virtualenv \033[0m\n"
virtualenv env_site -p "$PYTHON_INTERPRETER" virtualenv env_site -p "$PYTHON_INTERPRETER"
source env_site/bin/activate source env_site/bin/activate
pip3 install mysqldb
printf "\033[0;32m > Installation des dépendances \033[0m\n" printf "\033[0;32m > Installation des dépendances \033[0m\n"
pip install -r requirements.txt pip3 install -r requirements.txt
printf "\033[0;32m > Génération de la secret_key \033[0m\n" printf "\033[0;32m > Génération de la secret_key \033[0m\n"
@ -38,7 +39,9 @@ CREATE USER '$sql_login'@'localhost' IDENTIFIED BY '$sql_password';
GRANT ALL PRIVILEGES ON $sql_name.* TO '$sql_login'@'localhost'; GRANT ALL PRIVILEGES ON $sql_name.* TO '$sql_login'@'localhost';
FLUSH PRIVILEGES;" FLUSH PRIVILEGES;"
mysql -u root --execute="$mysql_command" echo "$mysql_command"
mysql -u root --execute="$mysql_command" -p
sed -i 's/db_engine/django.db.backends.mysql/g' site_tps/settings_local.py sed -i 's/db_engine/django.db.backends.mysql/g' site_tps/settings_local.py
@ -67,7 +70,7 @@ printf "\033[0;32m > Configuration de Apache \033[0m\n"
cp site_tps.conf /etc/apache2/sites-available cp site_tps.conf /etc/apache2/sites-available
sed -i 's,URL_SERVER,'"$url_server"',g' /etc/apache2/sites-available/site_tps.conf sed -i 's,URL_SERVER,'"$url_server"',g' /etc/apache2/sites-available/site_tps.conf
sed -i 's,INSTALL_PATH,'"$current_path"',g' /etc/apache2/sites-available/site_tps.conf sed -i 's,INSTALL_PATH,'"$current_path"',g' /etc/apache2/sites-available/site_tps.conf
a2ensite re2o a2ensite site_tps
service apache2 reload service apache2 reload
printf "\033[0;32m > Application des migrations \033[0m\n" printf "\033[0;32m > Application des migrations \033[0m\n"

View file

@ -8,7 +8,7 @@ SECRET_KEY = 'SUPER_SECRET_KEY'
DB_PASSWORD = 'db_pass' DB_PASSWORD = 'db_pass'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = False
# ADMINS = [('My Beloved Administrator', 'admin_mail')] # ADMINS = [('My Beloved Administrator', 'admin_mail')]