-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathrundemo.sh
executable file
·42 lines (36 loc) · 1012 Bytes
/
rundemo.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
#!/bin/sh
set -e
est -f .env && source .env
VERSION=${VERSION:-3}
POETRY=${POETRY:-false}
export LC_ALL=en_US.UTF-8
unset POETRY_RUN
# python${VERSION} -mvenv venv
# . venv/bin/activate
if $POETRY; then
echo "Using poetry"
if ! test -f pyproject.toml; then
echo "No pyproject.toml found. Please run this script from the root of the project"
exit 1
fi
if ! [ -x "$(command -v poetry)" ]
then
echo "poetry could not be found. Please install poetry: https://python-poetry.org/docs/#installation"
exit 1
else
poetry install
export POETRY_RUN="poetry run "
fi
else
echo "Using pip"
if ! [ -x "$(command -v pip${VERSION})" ]
then
echo "pip${VERSION} could not be found. Please install pip${VERSION}"
exit 1
else
. venv/bin/activate
fi
fi
${POETRY_RUN}python${VERSION} manage.py makemigrations
${POETRY_RUN}python${VERSION} manage.py migrate
${POETRY_RUN}python${VERSION} manage.py runserver