pip install -r requirements.txt
python manage.py makemigations
python manage.py migrate
python manage.py createsuperuser --email admin@example.com --username admin
python manage.py runserver
sudo apt-get update
sudo apt-install python-pip python-dev libpq-dev postgresql postgresql-contrib
sudo su - postgres
psql
In the postgres console
CREATE DATABASE dna_tree;
CREATE USER lakshan WITH PASSWORD 'lakshan';
ALTER ROLE lakshan SET client_encoding TO 'utf8';
ALTER ROLE lakshan SET default_transaction_isolation TO 'read committed';
ALTER ROLE lakshan SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE dna_tree TO lakshan;
\q
There are two docker compose files within this repository:
docker-compose.yml
contains the dev environmentprod.yml
contains the production environment
Setting up the docker dev environment is quite simple (it is assumed you have docker up and running, and you know how to use docker-compose):
- Run
docker-compose build
to build the Dockerfiles for this project - Run
sudo docker-compose exec db psql -U postgres
to log in to postgres terminal - Run the postgres installation commands.
- Run migrations:
docker-compose run --rm python python manage.py migrate
- Create a super user:
docker-compose run --rm python python manage.py createsuperuser
- Last but not least, we can start all services using
docker-compose up
. You should be able to access the app via http://0.0.0.0:8000/ in your browser.