install.bat 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. @echo off
  2. REM Function to check if a repository exists and perform git pull or git clone
  3. :update_repository
  4. setlocal
  5. set "repo_url=%~1"
  6. set "repo_dir=%~2"
  7. set "repo_branch=%~3"
  8. if exist "%repo_dir%" (
  9. rem If the directory exists, then do a git pull
  10. echo Updating %repo_dir%...
  11. cd "%repo_dir%" || exit /b
  12. git pull
  13. cd ..
  14. ) else (
  15. rem If the directory does not exist, then do a git clone
  16. echo Cloning %repo_url% into %repo_dir%...
  17. git clone -b %repo_branch% %repo_url% %repo_dir%
  18. )
  19. endlocal
  20. REM Update repositories
  21. call :update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-tickets.git" "tickets" "master"
  22. call :update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-backend.git" "metaservicesynced" "metasynced_module"
  23. call :update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-config.git" "conf" "master"
  24. call :update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-webapp-design-template.git" "design_template" "unstable"
  25. call :update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-webservice-running.git" "webservice_running" "unstable"
  26. call :update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-landing.git" "landing" "landing_module"
  27. git pull
  28. REM Create a Python virtual environment and activate it
  29. python -m venv venv
  30. .\venv\Scripts\activate
  31. REM Upgrade pip and install requirements
  32. pip install --upgrade pip
  33. pip install -r requirements.txt
  34. REM Checking for core/settings_vars.py
  35. if exist core\settings_vars.py (
  36. echo File settings_vars.py already exists
  37. ) else (
  38. copy core\_settings_vars.py core\settings_vars.py
  39. echo File settings_vars.py was successfully created
  40. )
  41. REM Run Django migrations and other commands
  42. python manage.py makemigrations SharixAdmin metaservicesynced tickets webservice_running landing
  43. python manage.py migrate
  44. python manage.py collectstatic --clear --no-input