0Pricing
Django Academy · درس

تشغيل python manage.py shell

افتح Shell محمّلًا بمشروعك

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

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

A Playground for Your Project

The Django shell is an interactive Python session that already knows about your project, so you can test ideas live without writing a file. 🧪

Why Not Just python?

Plain python can not import your models, because Django settings are not loaded. The shell command wires everything up for you first.

The One Command

You launch it through manage.py, the same script you use for everything else. It loads settings, then drops you into Python.

python manage.py shell

Run It from the Project Root

Run the command in the folder that holds manage.py. From there Django can find your settings and apps with no extra setup.

What the Prompt Looks Like

Once it starts, you see the familiar Python prompt with three chevrons. Anything you type runs instantly and shows its result.

>>> 2 + 2
4

Settings Are Already Loaded

Because settings are configured, you can read project values right away. Try printing your DEBUG flag to confirm the shell sees them.

>>> from django.conf import settings
>>> settings.DEBUG
True

Import and Explore

Now any model or utility is one import away. The shell is perfect for poking at code before you commit it to a file.

Multi-Line Blocks Work Too

You are not limited to one-liners. Start a loop or function and the prompt switches to dots until the block is complete.

>>> for i in range(3):
...     print(i)

Leaving the Shell

When you are done, type exit() or press Ctrl-D to return to your normal terminal. Nothing you typed is saved to disk.

>>> exit()

It Is Throwaway by Design

Treat the shell as a scratchpad. It is ideal for experiments, but real changes belong in views, models, or scripts you can rerun.

Database Writes Are Real

One caution: queries hit your real database. Saving an object in the shell changes data for good, so be careful on production.

Quick Check

Why use the Django shell instead of plain python?

Recap

You learned that manage.py shell opens an interactive Python session with your project loaded, perfect for quick experiments before writing real code. 🎉

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

هل درس «تشغيل python manage.py shell» مجاني؟

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

ماذا ستتعلم في «تشغيل python manage.py shell»؟

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

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

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

كم من الوقت يستغرق درس «تشغيل python manage.py shell»؟

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

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

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

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

  1. تشغيل python manage.py shell
  2. استيراد النماذج وفحصها
  3. إنشاء الكائنات وحفظها مباشرة
  4. ‏shell_plus وأدوات أفضل
← العودة إلى Django Academy