#!/bin/sh

cd /app

export PYTHONUSERBASE=/root/.local

if [[ ! -d /root/.local/bin ]]; then
  # instalar dependencias
  pip install --user -r requirements.txt
fi

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
