This project is a simple Django REST API for managing notes, running inside Docker containers with **PostgreSQL ** as the database.
- 
Make sure you have Docker and Docker Compose installed. 
- 
Clone the repository: 
git clone https://github.com/ralphmarondev/django-docker-setup.git
cd django-docker-setup- Build and start the containers:
docker compose up --build- Apply database migrations:
docker compose exec web python manage.py makemigrations
docker compose exec web python manage.py migrate- Visit the API at:
http://localhost:8000/api/
The Notes API allows you to create, list, and view notes. You can test it using tools like Postman, *
Insomnia*, or curl.
Endpoint:
GET http://localhost:8000/api/notes/
Sample response:
[
  {
    "id": 1,
    "title": "Hello docker",
    "content": "Is this working?",
    "create_date": "2025-06-12T04:49:38.100576Z",
    "is_deleted": false
  }
]Endpoint:
POST http://localhost:8000/api/note/create/
Request body:
{
  "title": "Hello docker",
  "content": "Is this working?"
}Response:
{
  "message": "Note created successfully",
  "note": {
    "id": 1,
    "title": "Hello docker",
    "content": "Is this working?",
    "create_date": "2025-06-12T04:59:19.929110Z",
    "is_deleted": false
  }
}You can view your notes and other tables directly from the running PostgreSQL container.
- Enter the PostgreSQL container:
docker compose exec db psql -U postgres -d hello- List all tables:
\dt
- Show notes:
SELECT * FROM notes_note;- Show Django users (if applicable):
SELECT * FROM auth_user;- Exit the database shell:
\q
To stop the containers:
docker compose downEdit .env for local credentials:
# PostgreSQL Config
POSTGRES_DB=hello
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
DB_HOST=db
DB_PORT=5432
# Django Config
DEBUG=True
SECRET_KEY=your-secret-keyA sample is available as .env_sample.
- Django + DRF-based Notes API
- Dockerized with PostgreSQL
- Easy to run locally and ready for production setups
- Tested with Postman
Feel free to fork and expand this for your own apps 🚀