diff --git a/setup.bat b/setup.bat new file mode 100644 index 0000000..26ffaf0 --- /dev/null +++ b/setup.bat @@ -0,0 +1,15 @@ + +start /wait python -m venv venv && venv\Scripts\activate && pip install -r requirements.txt &^ +echo Environment Setup Complete &^ +timeout 3 > NUL &^ +echo enter password for user postgres &^ +createdb -h localhost -p 5432 -U postgres cdc &^ +cd "CDC_Backend" &^ + +python manage.py flush --no-input &^ +python manage.py makemigrations &^ +python manage.py migrate &^ +echo Migrations complete &^ +cd .. &^ +start .\superuser.bat &^ +echo done successfully diff --git a/setup.sh b/setup.sh index 86a2bc3..aaa20b9 100644 --- a/setup.sh +++ b/setup.sh @@ -20,3 +20,11 @@ else echo "${DIR} Directory Created" fi +echo Do you want ceate credentials for super user (Y/N) ? +read create +create=${create^^} + +if [ "$create" == "Y" ]; then + ### Take action if user want to create ### + python3 manage.py createsuperuser +fi diff --git a/superuser.bat b/superuser.bat new file mode 100644 index 0000000..7afce95 --- /dev/null +++ b/superuser.bat @@ -0,0 +1,12 @@ +@echo off +set /p create="do you want to create supruser ? (Y/N) " + +cd "CDC_Backend" &^ + +if %create% equ Y ( python manage.py createsuperuser ) +if %create% equ y ( python manage.py createsuperuser ) + +python manage.py collectstatic --noinput +if exist Storage (echo Storage Directory already exists) else ( echo Creating Storage Directory... & mkdir Storage & echo Storage Directory Created) +timeout 3 > NUL +pause