- Clone this repository onto your local machine:
git clone https://github.com/speaq-ai/api.git
. - Install Docker if you don't already have it. Docker docs
- Create an
env
directory. Inside of that directory, create two files:api_dev.env
andpostgres_dev.env
. - Inside of
api_dev.env
, add the following variables, with the values I provided:
DB_PASSWORD=<your-db-password>
DB_USER=<your-db-username>
DB_NAME=<your-db-name>
DB_HOST=<your-db-host>
DB_PORT=<your-port>
- Inside of
postgres_dev.env
, add the following variables, with the values I provided:
POSTGRES_PASSWORD=<your-db-password>
POSTGRES_USER=<your-db-user>
POSTGRES_DB=<your-db-name>
-
Start the docker containers and create a django superuser with:
docker-compose up -d && docker exec -it speaq-api python manage.py createsuperuser
. Follow the prompts to create the super user. -
Finally, restart the docker containers:
docker-compose down && docker-compose up
. -
You're all set! Go to
localhost:8000/admin
and log in with the superuser credentials you supplied earlier.
Start the Docker containers with docker-compose up
Once the containers are running, you can access the API's admin dashboard at localhost:8000/admin
.
These are the components I've included steps I took to configure them for this project. No need understand everything going on here, but I wanted to give a high-level overview for reference.
- Django
- Postgres
- Docker
- create venv
- install django, djangorestframework, psycopg
- freeze requirements to a
requirements.txt
file - use
django-admin
to create project and needed apps inside ofsrc
directory. - set up
Dockerfile
anddocker-compose.yaml
- configure django database settings to use postgres engine
- use manage.py to run initial migration
- once docker network is up and running, use manage.py to create super user inside container.
- include the
./src
directory as a docker volume in API service to enable hot reloads.