install.bat 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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-webadmin.git" "SharixAdmin\templates\SharixAdmin" "webinterface"
  24. call :update_repository "https://git.sharix-app.org/ShariX_Open/sharix-open-config.git" "conf" "master"
  25. git pull
  26. REM Create a Python virtual environment and activate it
  27. python -m venv venv
  28. .\venv\Scripts\activate
  29. REM Upgrade pip and install requirements
  30. pip install --upgrade pip
  31. pip install -r requirements.txt
  32. REM Checking for core/config.py
  33. if exist core\config.py (
  34. echo File config.py already created
  35. ) else (
  36. copy core\_config.py core\config.py
  37. echo File config.py was successfully created
  38. )
  39. REM Run Django migrations and other commands
  40. python manage.py makemigrations SharixAdmin metaservicesynced tickets
  41. python manage.py migrate
  42. python manage.py collectstatic --clear --no-input