Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

Commit

Permalink
[update] change relative directory to absolute directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
counter2015 committed Nov 21, 2019
1 parent 6a356b3 commit 2b1e2a7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
9 changes: 5 additions & 4 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ RDIR="$( dirname "$SOURCE" )"
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"

# prepare data dir
dir_names=(${DIR}"/../var/celery")
projDir=`git rev-parse --show-toplevel`
dir_names=($projDir"var/celery")
for dir_name in ${dir_names[@]}
do
if [ ! -d ${dir_name} ]; then
Expand All @@ -28,13 +29,13 @@ do
done

# migrate database schema
env="../env/bin/activate"
env="$projDir/env/bin/activate"
if [ -f ${env} ]; then
echo "use venv : $env"
source ../env/bin/activate
source $projDir/env/bin/activate
else
echo "venv not found, use local environment"
fi

python "../manage.py" migrate
python "$projDir/manage.py" migrate

11 changes: 6 additions & 5 deletions bin/run.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#!/usr/bin/env bash
projDir=`git rev-parse --show-toplevel`

env="../env/bin/activate"
env="$projDir/env/bin/activate"
if [ -f ${env} ]; then
echo "use venv : $env"
source ../env/bin/activate
source $projDir/env/bin/activate
else
echo "venv not found, use local environment"
fi

nohup python3 "../manage.py" runserver 0:8011 >> ../var/server.log_`date "+%Y-%m-%d"` 2>&1 &
nohup python3 "$projDir/manage.py" runserver 0:8011 >> $projDir/var/server.log_`date "+%Y-%m-%d"` 2>&1 &
pid=$!
echo pid=$pid
echo $pid > ../var/pid
echo $pid > $projDir/var/pid


projDir=`git rev-parse --show-toplevel`
cd $projDir


Expand Down
5 changes: 3 additions & 2 deletions bin/stop.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env bash
projDir=`git rev-parse --show-toplevel`

pid=`cat ../var/pid`
pid=`cat $projDir/var/pid`
kill $pid
echo stop pid=$pid

projDir=`git rev-parse --show-toplevel`

cd $projDir

celery multi stopwait worker1 -A proj -l info \
Expand Down
8 changes: 4 additions & 4 deletions bin/venv_init.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash

projDir=`git rev-parse --show-toplevel`
# you should first install virtualenv like `pip install --user virtualenv`

virtualenv --no-site-packages ../env
source ../env/bin/activate
pip3 install -r ../requirements.txt
virtualenv --no-site-packages $projDir/env
source $projDir/env/bin/activate
pip3 install -r $projDir/requirements.txt
deactivate

0 comments on commit 2b1e2a7

Please sign in to comment.