mirror of https://github.com/doccano/doccano.git
pythonannotation-tooldatasetsactive-learningtext-annotationdatasetnatural-language-processingdata-labelingmachine-learning
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1005 B
35 lines
1005 B
#!/usr/bin/env bash
|
|
|
|
set -o errexit
|
|
|
|
root="$(dirname "$0")/../.."
|
|
app="${root}/app"
|
|
venv="${root}/venv"
|
|
|
|
if [[ ! -f "${venv}/bin/python" ]]; then
|
|
echo "Creating virtualenv"
|
|
mkdir -p "${venv}"
|
|
python3 -m venv "${venv}"
|
|
"${venv}/bin/pip" install --upgrade pip setuptools
|
|
fi
|
|
|
|
echo "Installing dependencies"
|
|
apt-get update && apt-get install -y g++ unixodbc-dev # pyodbc build dependencies
|
|
"${venv}/bin/pip" install -r "${app}/requirements.txt"
|
|
|
|
echo "Initializing database"
|
|
"${venv}/bin/python" "${app}/manage.py" wait_for_db
|
|
"${venv}/bin/python" "${app}/manage.py" migrate
|
|
"${venv}/bin/python" "${app}/manage.py" create_roles
|
|
|
|
if [[ -n "${ADMIN_USERNAME}" ]] && [[ -n "${ADMIN_PASSWORD}" ]] && [[ -n "${ADMIN_EMAIL}" ]]; then
|
|
"${venv}/bin/python" "${app}/manage.py" create_admin \
|
|
--username "${ADMIN_USERNAME}" \
|
|
--password "${ADMIN_PASSWORD}" \
|
|
--email "${ADMIN_EMAIL}" \
|
|
--noinput \
|
|
|| true
|
|
fi
|
|
|
|
echo "Starting django"
|
|
"${venv}/bin/python" -u "${app}/manage.py" runserver "$@"
|