From 457bb862a99f687b8dd60d01066d0294465ea85a Mon Sep 17 00:00:00 2001 From: kasv-p <84275697+kasv-p@users.noreply.github.com> Date: Sat, 28 May 2022 23:04:06 +0530 Subject: [PATCH 1/4] Add files via upload place superuser.bat file in cdc_backend folder and setup.bat in cdc folder. updated setup.sh please check and review --- setup.bat | 12 ++++++++++++ superuser.bat | 11 +++++++++++ 2 files changed, 23 insertions(+) create mode 100644 setup.bat create mode 100644 superuser.bat diff --git a/setup.bat b/setup.bat new file mode 100644 index 0000000..73da3f2 --- /dev/null +++ b/setup.bat @@ -0,0 +1,12 @@ + +start /wait python -m venv venv && venv\Scripts\activate && pip install -r requirements.txt &^ +echo Environment Setup Complete &^ +timeout 3 > NUL &^ +cd "CDC_Backend" &^ + +python manage.py flush --no-input &^ +python manage.py makemigrations &^ +python manage.py migrate &^ +echo Migrations complete &^ +start superuser.bat &^ +echo done successfully diff --git a/superuser.bat b/superuser.bat new file mode 100644 index 0000000..88d3591 --- /dev/null +++ b/superuser.bat @@ -0,0 +1,11 @@ +@echo off +set /p create="do you want to create supruser ? (Y/N) " + + +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 From b04b53069c1b72f1e0483ca667100144cbcc3cc9 Mon Sep 17 00:00:00 2001 From: kasv-p <84275697+kasv-p@users.noreply.github.com> Date: Sat, 28 May 2022 23:07:38 +0530 Subject: [PATCH 2/4] Update setup.sh --- setup.sh | 8 ++++++++ 1 file changed, 8 insertions(+) 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 From a05ec1430f876803ca995880494ab87a6ece11f6 Mon Sep 17 00:00:00 2001 From: kasv-p <84275697+kasv-p@users.noreply.github.com> Date: Mon, 6 Jun 2022 19:03:04 +0530 Subject: [PATCH 3/4] creating db command added --- setup.bat | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.bat b/setup.bat index 73da3f2..26ffaf0 100644 --- a/setup.bat +++ b/setup.bat @@ -2,11 +2,14 @@ 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 &^ -start superuser.bat &^ +cd .. &^ +start .\superuser.bat &^ echo done successfully From 76b9cfc9b8ffb4c177662897410b522cc2c36734 Mon Sep 17 00:00:00 2001 From: kasv-p <84275697+kasv-p@users.noreply.github.com> Date: Mon, 6 Jun 2022 19:25:25 +0530 Subject: [PATCH 4/4] Update superuser.bat --- superuser.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/superuser.bat b/superuser.bat index 88d3591..7afce95 100644 --- a/superuser.bat +++ b/superuser.bat @@ -1,6 +1,7 @@ @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 )