#!/bin/sh

# instalar dependencias
cd /app

if [[ ! -d ./dependencias ]]; then
  python -m venv dependencias
  . ./dependencias/bin/activate
  pip install -r requirements.txt
fi
. ./dependencias/bin/activate


if [[ ! -d ./project ]]; then
  django-admin startproject project
fi

chmod o+w -R project/

if [[ ! -f .env  ]] && [[ -f .env.develop ]]; then
  cp .env.develop .env
fi

# iniciar servidor
python ./project/manage.py runserver 0.0.0.0:$PORT
