2017-04-24 15:51:12 +00:00
|
|
|
# -*- coding:utf-8 -*
|
|
|
|
#
|
2023-04-04 16:39:45 +00:00
|
|
|
# Copyright 2023 © AE UTBM
|
|
|
|
# ae@utbm.fr / ae.info@utbm.fr
|
2017-04-24 15:51:12 +00:00
|
|
|
#
|
2023-04-04 16:39:45 +00:00
|
|
|
# This file is part of the website of the UTBM Student Association (AE UTBM),
|
|
|
|
# https://ae.utbm.fr.
|
2017-04-24 15:51:12 +00:00
|
|
|
#
|
2023-04-04 16:39:45 +00:00
|
|
|
# You can find the source code of the website at https://github.com/ae-utbm/sith3
|
2017-04-24 15:51:12 +00:00
|
|
|
#
|
2023-04-04 16:39:45 +00:00
|
|
|
# LICENSED UNDER THE GNU GENERAL PUBLIC LICENSE VERSION 3 (GPLv3)
|
|
|
|
# SEE : https://raw.githubusercontent.com/ae-utbm/sith3/master/LICENSE
|
|
|
|
# OR WITHIN THE LOCAL FILE "LICENSE"
|
2017-04-24 15:51:12 +00:00
|
|
|
#
|
|
|
|
#
|
|
|
|
|
2015-12-04 15:13:20 +00:00
|
|
|
import os
|
2024-06-24 11:07:36 +00:00
|
|
|
|
2015-12-03 17:00:08 +00:00
|
|
|
from django.core.management import call_command
|
2024-06-24 11:07:36 +00:00
|
|
|
from django.core.management.base import BaseCommand
|
2016-01-28 15:53:37 +00:00
|
|
|
|
|
|
|
|
2015-12-03 17:00:08 +00:00
|
|
|
class Command(BaseCommand):
|
|
|
|
help = "Set up a new instance of the Sith AE"
|
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
2018-10-04 19:29:19 +00:00
|
|
|
root_path = os.path.dirname(
|
|
|
|
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
|
|
|
)
|
2015-12-03 17:00:08 +00:00
|
|
|
try:
|
2018-10-04 19:29:19 +00:00
|
|
|
os.mkdir(os.path.join(root_path) + "/data")
|
2017-01-07 09:36:54 +00:00
|
|
|
print("Data dir created")
|
2016-01-28 15:53:37 +00:00
|
|
|
except Exception as e:
|
2017-01-07 09:36:54 +00:00
|
|
|
repr(e)
|
|
|
|
try:
|
2018-10-04 19:29:19 +00:00
|
|
|
os.remove(os.path.join(root_path, "db.sqlite3"))
|
2017-01-07 09:36:54 +00:00
|
|
|
print("db.sqlite3 deleted")
|
|
|
|
except Exception as e:
|
|
|
|
repr(e)
|
2018-10-04 19:29:19 +00:00
|
|
|
call_command("migrate")
|
2023-05-02 09:00:23 +00:00
|
|
|
call_command("populate")
|