5 Commits

Author SHA1 Message Date
ducoterra
b4dfdaeac7 use raspbian-dev git install 2018-12-12 21:58:31 -05:00
ducoterra
ac8b6d8941 add shebang 2018-12-12 21:57:18 -05:00
ducoterra
f7b8d6da96 always update allowed hosts 2018-10-08 23:29:27 -04:00
ducoterra
2258b1df0e add branch option 2018-10-08 23:23:28 -04:00
ducoterra
7a2ec49b6d update git settings 2018-10-08 23:21:05 -04:00
4 changed files with 27 additions and 14 deletions

View File

@@ -1,3 +1,5 @@
#!/bin/bash
################################################################################s ################################################################################s
# Dependencies # Dependencies
# Installs Dependencies automatically # Installs Dependencies automatically
@@ -181,14 +183,6 @@ if [ $usegit = False ] ; then
exit 1 exit 1
fi fi
# update allowed hosts
echo -e "echo -e sed -i 's/ALLOWED_HOSTS = []/ALLOWED_HOSTS = ['localhost', os.environ.get('HOST')'] config/settings.py" >> $djalogloc
# | FROM | TO |
sed -i "s/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = \['localhost', os.environ.get('HOST')\]/" config/settings.py
if [ $? -ne 0 ] ; then
echo -e "Failed to change ALLOWED_HOSTS. $djamsg"
exit 1
fi
echo -e "echo -e STATIC_ROOT = os.path.join(BASE_DIR, 'static') >> config//settings.py" >> $djalogloc echo -e "echo -e STATIC_ROOT = os.path.join(BASE_DIR, 'static') >> config//settings.py" >> $djalogloc
echo -e "STATIC_ROOT = os.path.join(BASE_DIR, 'static')" >> config/settings.py echo -e "STATIC_ROOT = os.path.join(BASE_DIR, 'static')" >> config/settings.py
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
@@ -199,17 +193,26 @@ fi
if [ $usegit = True ] ; then if [ $usegit = True ] ; then
echo -e "\tCloning django project" echo -e "\tCloning django project"
ssh-agent bash -c 'ssh-add $gitkey 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc;
git init 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc; git init 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc;
git remote add origin $giturl 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc; git remote add origin $giturl 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc;
ssh-agent bash -c 'ssh-add $gitkey 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc;
git pull origin master 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc;' git pull origin master 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc;'
echo -e "\tInstalling pip requirements" echo -e "\tInstalling pip requirements"
pip install -r requirements.txt 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc pip install -r requirements.txt 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc
fi fi
# update allowed hosts
echo -e "echo -e sed -i 's/ALLOWED_HOSTS = []/ALLOWED_HOSTS = ['localhost', os.environ.get('HOST')'] config/settings.py" >> $djalogloc
# | FROM | TO |
sed -i "s/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = \['localhost', os.environ.get('HOST')\]/" config/settings.py
if [ $? -ne 0 ] ; then
echo -e "Failed to change ALLOWED_HOSTS. $djamsg"
exit 1
fi
# collect static, migrate # collect static, migrate
echo -e "\tCollecting static" echo -e "\tCollecting static"
python manage.py collectstatic 1>> $djalogloc 2>> $djalogloc 3>> $djalogloc python manage.py collectstatic --noinput 1>> $djalogloc 2>> $djalogloc 3>> $djalogloc
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
echo -e "Failed to collect static files. $djamsg" echo -e "Failed to collect static files. $djamsg"
exit 1 exit 1

View File

@@ -1,3 +1,5 @@
#!/bin/bash
################################################################################ ################################################################################
# Performs a QUICK uninstall # # Performs a QUICK uninstall #
# - Does not uninstall dependencies # # - Does not uninstall dependencies #

View File

@@ -1,3 +1,5 @@
#!/bin/bash
################################################################################ ################################################################################
# Performs a FULL uninstall # # Performs a FULL uninstall #
################################################################################ ################################################################################

14
vars
View File

@@ -1,11 +1,17 @@
#!/bin/bash
# django project settings # django project settings
export user="" export user=""
export projectname="" export projectname=""
export hostname="" export hostname=""
export usegit=False # if you have a django git project
export giturl="" # url for git project # MAKE SURE root HAS A DEPLOY KEY
export gitkey="" # IdentityFile export usegit=False
install_epel_release=False export giturl=""
export gitbranch=""
export gitkey=""
export install_epel_release=False
# general install settings # general install settings
export logdir="/var/log/djangosetup/" export logdir="/var/log/djangosetup/"