-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployment_django_project.sh
38 lines (33 loc) · 1.09 KB
/
deployment_django_project.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
#
# This is a bash script for a specific project, which you can see down this link: 'https://github.com/Gr0ki/ABPZ.git'
# The script automates downloading the Django project from a remote repository that sets everything up for the first run.
if [ "$(ls | grep ABPZ)" != "ABPZ" ]; then
echo
echo
echo "<------- Clonning the repository for the Practical Work 1 ------->"
echo
git clone --branch PW1 --single-branch https://github.com/Gr0ki/ABPZ.git
fi
if [[ "$PWD" != "ABPZ" ]]; then
cd "ABPZ"
fi
echo
echo
echo "<------- Setting up a virtual environment ------->"
echo
if [ "$(ls | grep manage.py)" != "venv" ]; then
python3 -m venv venv
fi
source venv/bin/activate
pip install -r requirements.txt
echo
echo
echo "<------- Creating a superuser with a username: \"admin\" and password: \"admin\" ------->"
echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', '[email protected]', 'admin')" | python3 manage.py shell 2>/dev/null
echo "Done!"
echo
echo
echo "<------- Starting up the server... ------->"
echo
python3 manage.py runserver