-
Notifications
You must be signed in to change notification settings - Fork 0
/
crud-in-python.sh
87 lines (80 loc) · 2.78 KB
/
crud-in-python.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
BROWN='\033[0;33m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
CYAN='\033[1;36m'
NC='\033[0m' # No Color
clear
echo -e " ${BROWN}#############################################${NC}"
echo -e " ${BROWN}# crud in python #${NC}"
echo -e " ${BROWN}#-------------------------------------------#${NC}"
echo -e " ${BROWN}# Author : Yogesh Nile #${NC}"
echo -e " ${BROWN}# Email : yogeshnile.work4u@gmail.com #${NC}"
echo -e " ${BROWN}# Twitter : twitter.com/YogeshNile #${NC}"
echo -e " ${BROWN}# GitHub : github.com/yogeshnile #${NC}"
echo -e " ${BROWN}#############################################${NC}"
if [ -x crud-in-python.sh ]
then
cd ~/Downloads/
filename=crud-in-python
if [ -e $filename ]
then
echo -e "${RED}Repo already exit.${NC}"
rm -rf crud-in-python
if [ $? -eq 0 ]
then
echo -e "${GREEN}Repo Deleted.${NC}"
echo -e "${YELLOW}Downloading ${NC}${BROWN}crud-in-python ${NC}${YELLOW}files....${NC}"
git clone https://github.com/yogeshnile/crud-in-python.git
echo -e "${GREEN}Finished : ${NC}${YELLOW}Downloading required files${NC}"
else
echo -e "${RED}Error: Can't remove repo.${NC}"
fi
else
echo -e "${YELLOW}Downloading ${NC}${BROWN}crud-in-python ${NC}${YELLOW}files....${NC}"
git clone https://github.com/yogeshnile/crud-in-python.git
echo -e "${GREEN}Finished : ${NC}${YELLOW}Downloading required files${NC}"
fi
if [ $? -eq 0 ]
then
#moveing crud-in-python repo
cd crud-in-python
#Create Virtual Env
echo -e "${YELLOW}Starting : ${NC}${BLUE}Python Virtual Environment....${NC}"
python3 -m venv venv
if [ $? -eq 0 ]
then
echo -e "${GREEN}Finished : ${NC}${YELLOW}Python Virtual Environment${NC}"
#Activate venv
echo -e "${YELLOW}Activate Virtual Environment.....${NC}"
source venv/bin/activate
if [ $? -eq 0 ]
then
echo -e "${GREEN}Activated Virtual Environment${NC}"
#Install All Python Libraris
echo "${YELLOW}Starting : ${NC}${CYAN}Install All Dependencies......${NC}"
pip install -r requirements.txt
if [ $? -eq 0 ]
then
echo -e "${GREEN}Finished : Installed All Dependencie${NC}"
#Run python file
echo -e "${GREEN}Running Python File.....${NC}"
echo -e "${YELLOW}Wait for activate localhost....${NC}"
python app.py
else
echo -e "${RED}Error: All Dependencie does not installed please check internet connectivity${NC}"
fi
else
echo -e "${RED}Error: venv does not activated.${NC}"
fi
else
echo -e "${RED}Error:${NC}${CYAN} python virtual environment don't create${NC}"
fi
else
echo -e "${RED}Repo don't downloaded..please check internet connectivity${NC}"
fi
else
echo -e "${RED}Error: File required executable permission${NC}"
fi