déploiement

This commit is contained in:
root 2018-03-12 00:00:04 +01:00
parent c8a1d9a3e6
commit 9fc03bd511
4 changed files with 6 additions and 22 deletions

View file

@ -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

View file

@ -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.'))