From 9fc03bd511ddab1592c36cecef0c4bf2e4ba32d6 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 12 Mar 2018 00:00:04 +0100 Subject: [PATCH] =?UTF-8?q?d=C3=A9ploiement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy.sh | 12 ++++++------ settings/management/__init__.py | 0 settings/management/commands/__init__.py | 0 settings/management/commands/create_admin.py | 16 ---------------- 4 files changed, 6 insertions(+), 22 deletions(-) delete mode 100644 settings/management/__init__.py delete mode 100644 settings/management/commands/__init__.py delete mode 100644 settings/management/commands/create_admin.py diff --git a/deploy.sh b/deploy.sh index 950368b..d5ff40b 100644 --- a/deploy.sh +++ b/deploy.sh @@ -46,10 +46,10 @@ 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_name/'"$db_name"'/g' site_tps/settings_local.py -sed -i 's/db_user/'"$db_user"'/g' site_tps/settings_local.py -sed -i 's/db_pass/'"$db_pass"'/g' site_tps/settings_local.py -sed -i 's/db_host/'"$db_host"'/g' site_tps/settings_local.py +sed -i 's/db_name/'"$sql_name"'/g' site_tps/settings_local.py +sed -i 's/db_user/'"$sql_login"'/g' site_tps/settings_local.py +sed -i 's/db_pass/'"$sql_password"'/g' site_tps/settings_local.py +sed -i 's/db_host/'"$sql_host"'/g' site_tps/settings_local.py #printf "\033[0;32m > Configuration des mails \033[0m\n" @@ -72,13 +72,13 @@ 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,INSTALL_PATH,'"$current_path"',g' /etc/apache2/sites-available/site_tps.conf a2ensite site_tps +rm /etc/apache2/sites-enabled/000-default.conf service apache2 reload + printf "\033[0;32m > Application des migrations \033[0m\n" python manage.py migrate printf "\033[0;32m > Collecte des statiques \033[0m\n" python manage.py collectstatic -printf "\033[0;32m > Création du groupe admin \033[0m\n" -python manage.py create_admin printf "\033[0;32m > Création d'un super utilisateur\033[0m\n" python manage.py createsuperuser diff --git a/settings/management/__init__.py b/settings/management/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/settings/management/commands/__init__.py b/settings/management/commands/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/settings/management/commands/create_admin.py b/settings/management/commands/create_admin.py deleted file mode 100644 index c17c02e..0000000 --- a/settings/management/commands/create_admin.py +++ /dev/null @@ -1,16 +0,0 @@ -from django.core.management.base import BaseCommand, CommandError -from django.contrib.auth.models import Group, Permission - -class Command(BaseCommand): - help = 'Creates admin group' - - def handle(self, *args, **options): - admins,_ = Group.objects.get_or_create(name='admins') - admins.permissions.add(Permission.objects.get(codename="change_sitesettings")) - admins.permissions.add(Permission.objects.get(codename="add_schoolprofile")) - admins.permissions.add(Permission.objects.get(codename="delete_schoolprofile")) - admins.permissions.add(Permission.objects.get(codename="add_category")) - admins.permissions.add(Permission.objects.get(codename="delete_category")) - admins.permissions.add(Permission.objects.get(codename="change_category")) - admins.save() - self.stdout.write(self.style.SUCCESS('Admins created.'))