Skip to content
Learn Netverks

Lesson

Step 13/36 36% through track

settings-intro

settings.py introduction

Last reviewed Jun 1, 2026 Content v20260601
Track mode
server_script
Means
Server runner
Reading
~1 min
Level
beginner

This lesson

An orientation to the Django track—how the server playground works, core vocabulary, and what you will practice next.

You need a clear map of the Django track so MVT, the ORM, and project layout do not feel like magic.

You will apply settings.py introduction in contexts like: SaaS dashboards, CMS-style products, internal tools, and APIs paired with React or mobile clients.

Write Python 3 in the editor and click Run on server—the dev runner executes your script; Django framework lessons also use local startproject for full MVT (LEARNING_RUNNER_ENABLED=true). Also read the interview prep blocks.

After HTML fundamentals and basic programming concepts—before or alongside SQL.

settings.py is Django's control panel—database, installed apps, middleware, templates, static files, and security flags all live here (or in split settings modules for production).

Settings you touch early

  • DEBUGTrue in development only; never in production
  • SECRET_KEY — signs sessions/CSRF; keep secret, rotate if leaked
  • ALLOWED_HOSTS — hostnames the site will serve (required when DEBUG is False)
  • DATABASES — default SQLite locally; PostgreSQL in production
  • INSTALLED_APPS, MIDDLEWARE, TEMPLATES, STATIC_URL

Environment-specific settings

Mature projects use settings/base.py, dev.py, prod.py and env vars for secrets—never commit production SECRET_KEY or DB passwords.

Important interview questions and answers

  1. Q: Why is DEBUG=False in production?
    A: DEBUG exposes stack traces and sensitive settings to attackers—use logging and Sentry instead.
  2. Q: Where should SECRET_KEY live?
    A: Environment variable or secret manager—not in git.
  3. Q: Default dev database?
    A: SQLite (db.sqlite3)—fine for learning; PostgreSQL is standard for production Django.

Self-check

  1. What happens if ALLOWED_HOSTS is empty and DEBUG is False?
  2. Name two settings that must differ between dev and prod.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • DEBUG prod risk?
  • INSTALLED_APPS why?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump