0Pricing
Django Academy · درس

جولة في settings.py

الإعدادات الأساسية التي يعتمد عليها كل مشروع

جولة في settings.py درس مجاني في Django Academy على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Django Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Django Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

One File, Whole Project

The settings.py file is the control panel for your entire project. Nearly every Django behavior is configured from this one place. 🎛️

It Is Just Python

Settings are plain Python variables, so you can compute them with code. That flexibility is powerful, but it means typos break startup loudly.

BASE_DIR Anchors Paths

BASE_DIR points to your project root. Other settings build paths from it so your app works no matter where it is installed.

BASE_DIR = Path(__file__).resolve().parent.parent

DEBUG Controls Detail

DEBUG shows rich error pages while you build. You must set it to False in production, or you leak sensitive details to visitors. ⚠️

DEBUG = True

SECRET_KEY Signs Things

The SECRET_KEY secures sessions, cookies, and password resets. Keep it private and never commit the real one to version control.

ALLOWED_HOSTS Guards Access

ALLOWED_HOSTS lists the domains your site may serve. It blocks requests with a faked Host header, an important safety check.

ALLOWED_HOSTS = ["example.com"]

INSTALLED_APPS Lives Here

The familiar INSTALLED_APPS list sits in settings too. It declares which apps, yours and Django's, are active in this project.

MIDDLEWARE Wraps Requests

The MIDDLEWARE list defines layers that process every request and response, handling things like security and sessions in order.

DATABASES Defines Storage

The DATABASES setting tells Django where to store data. New projects start with SQLite, a simple file-based database.

DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3"}}

TEMPLATES and Static

TEMPLATES configures HTML rendering, while STATIC_URL sets where CSS and JS are served from. Both shape how pages reach the browser.

Locale and Time

Settings like TIME_ZONE and LANGUAGE_CODE control formatting and translation, so your app feels right for its users worldwide. 🌍

TIME_ZONE = "UTC"

Quick Check

Which setting must be False before you go live?

Recap: You Know the Panel

You toured settings.py: BASE_DIR, DEBUG, SECRET_KEY, ALLOWED_HOSTS, apps, middleware, and databases. This file steers the whole project. 🧭

الأسئلة الشائعة

هل درس «جولة في settings.py» مجاني؟

نعم — نص درس «جولة في settings.py» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Django Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Django Academy 4 دروس في المجموع.

ماذا ستتعلم في «جولة في settings.py»؟

الإعدادات الأساسية التي يعتمد عليها كل مشروع تتمرن على Django Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Django Academy؟

لا تُشترط خبرة سابقة. Django Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.

كم من الوقت يستغرق درس «جولة في settings.py»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Django Academy هذا؟

نعم. كل درس في Django Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. ‏startapp وتخطيط مجلد التطبيق
  2. تسجيل التطبيقات في INSTALLED_APPS
  3. جولة في settings.py
  4. ‏manage.py: مركز قيادة مشروعك
← العودة إلى Django Academy