0Pricing
Django Academy · Ders

Postgres ve Redis ile docker-compose

Tüm yığını tek bir komutla çalıştırın.

Postgres ve Redis ile docker-compose, CoddyKit'te ücretsiz bir Django Academy dersidir. Bu, 4 dersinin 2. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Django Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Django Academy kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

One Command, Whole Stack

docker-compose defines many containers in one file, so Django, Postgres, and Redis start together with a single command. 🧩

The compose File

Everything lives in docker-compose.yml, where each container you need becomes an entry under the services key.

services:
  web:
  db:
  redis:

The web Service

Your web service builds from your Dockerfile and runs Django, the heart of the whole stack.

web:
  build: .
  command: gunicorn config.wsgi:application --bind 0.0.0.0:8000

Add Postgres

The db service uses the official Postgres image, giving you a real database without installing anything locally.

db:
  image: postgres:16

Add Redis

The redis service runs the official Redis image, ready to act as a cache or a Celery message broker.

redis:
  image: redis:7

Connect by Service Name

Compose gives each service a DNS name, so Django reaches Postgres at the host db, not localhost.

DATABASE_URL=postgres://user:pass@db:5432/app

Wait with depends_on

Use depends_on so web starts after db and redis, keeping your startup order sane.

web:
  depends_on:
    - db
    - redis

Persist Data with Volumes

A named volume stores Postgres data outside the container, so your rows survive restarts and rebuilds.

db:
  volumes:
    - pgdata:/var/lib/postgresql/data

Pass Configuration as Env

Feed secrets and settings through environment or an env_file, keeping config out of your image.

db:
  environment:
    POSTGRES_DB: app
    POSTGRES_PASSWORD: pass

Map Ports to Your Host

The ports key forwards a container port to your machine, so you can open the app in a browser.

web:
  ports:
    - "8000:8000"

Bring It All Up

Run docker compose up and the entire stack boots together; add -d to run it in the background.

docker compose up -d

Quick Check

How does your web container reach the database in Compose?

Recap

You wired a full stack in docker-compose: web, db, and redis services, connected by name, with volumes for data and one command to launch. 🚀

Sıkça Sorulan Sorular

“Postgres ve Redis ile docker-compose” dersi ücretsiz mi?

Evet — “Postgres ve Redis ile docker-compose” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Django Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Django Academy kursu toplamda 4 dersten oluşur.

“Postgres ve Redis ile docker-compose” dersinde ne öğreneceğim?

Tüm yığını tek bir komutla çalıştırın. Django Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Django Academy öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Django Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 2. dersidir.

“Postgres ve Redis ile docker-compose” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Django Academy dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Django Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Django Dockerfile'ı Yazma
  2. Postgres ve Redis ile docker-compose
  3. Giriş Noktaları, Geçişler ve collectstatic
  4. Üretim İmajı için En İyi Uygulamalar
← Django Academy Sayfasına Dön