Showing posts with label Shell. Show all posts
Showing posts with label Shell. Show all posts

Sunday, 19 February 2017

Simple Shell script to install and run your flask application for first time.


Simple shell script to clone your flask app , installing requirements, activating virtual environment and running the application.
Fork me on GitHub



#!/bin/ksh

CURRENT_DIR=`pwd`
echo "please enter your repo link" #input your repo link
read input_variable  #Read input
echo $input_variable
REPOURL=$input_variable
#REPOURL=$input_variable
gitdir=`basename $input_variable .git`

if  [[ ! -d $CURRENT_DIR/$gitdir ]]
then 
git clone $REPOURL 
elif [[ ! -d $CURRENT_DIR/$gitdir/.git ]]
then
mv CURRENT_DIR/$gitdir CURRENT_DIR/$gitdir"_backup" 
git clone $REPOURL
fi
cd $CURRENT_DIR/$gitdir
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
python app.py