Changeset View
Changeset View
Standalone View
Standalone View
api.sh
Show All 32 Lines | then | ||||
echo "Something is running on port 8000." | echo "Something is running on port 8000." | ||||
exit 2 | exit 2 | ||||
fi | fi | ||||
exit 0 # --norun exits successfully if its running already | exit 0 # --norun exits successfully if its running already | ||||
else | else | ||||
if [[ $1 = "--norun" ]] | if [[ $1 = "--norun" ]] | ||||
then | then | ||||
if which lsof >/dev/null | |||||
then | |||||
echo "Nothing is currently running on port 8000." | echo "Nothing is currently running on port 8000." | ||||
echo "You might need to run ./api.sh to launch the API." | echo "You might need to run ./api.sh to launch the API." | ||||
exit 1 # Failure | exit 1 # Failure | ||||
else | |||||
echo "Command 'lsof' is not installed, impossible to know if the API is running or not." | |||||
echo "Assuming the API is not running, will now attempt to run it." | |||||
fi | |||||
fi | fi | ||||
echo "Setting up the submodule(s)..." | echo "Setting up the submodule(s)..." | ||||
git submodule init | git submodule init | ||||
git submodule update | git submodule update | ||||
echo "Checking if there is a new version of the API..." | echo "Checking if there is a new version of the API..." | ||||
cd api | cd api | ||||
Show All 9 Lines | else | ||||
echo "Running the virtual environment..." | echo "Running the virtual environment..." | ||||
source env/bin/activate | source env/bin/activate | ||||
echo "Installing requirements..." | echo "Installing requirements..." | ||||
python3.6 -m pip install -r requirements.txt | python3.6 -m pip install -r requirements.txt | ||||
echo "Preparing the database..." | echo "Preparing the database..." | ||||
rm db.sqlite3 | test -f db.sqlite3 && rm db.sqlite3 | ||||
python3.6 manage.py migrate | python3.6 manage.py migrate | ||||
echo "Starting the development server..." | echo "Starting the development server..." | ||||
python3.6 manage.py sampledata | python3.6 manage.py sampledata | ||||
exec python3.6 manage.py runserver | exec python3.6 manage.py runserver & | ||||
fi | fi |