0Pricing
Django Academy · درس

‏shell_plus وأدوات أفضل

سرّع العمل في Shell باستخدام django-extensions

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

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

The Tedious Part

The default shell makes you import every model by hand each session. That repetition gets old fast on real projects.

Meet shell_plus

shell_plus is an upgraded shell from the django-extensions package. It auto-imports your models and common helpers for you.

Install the Package

First add the tool with pip. django-extensions bundles shell_plus along with many other handy commands.

pip install django-extensions

Register It in Settings

Next add it to INSTALLED_APPS so Django loads the new commands. Without this step the shell_plus command stays hidden.

INSTALLED_APPS = [
    "django_extensions",
]

Launch shell_plus

Now start it through manage.py just like the regular shell. On startup it prints every model it imported for you.

python manage.py shell_plus

Models Are Just There

No imports needed: Post, Comment, and the rest are ready instantly. You jump straight into querying your data.

>>> Post.objects.count()

See the SQL It Runs

Add the print-sql flag to echo the SQL behind each query. It is a great way to learn what the ORM generates.

python manage.py shell_plus --print-sql

Nicer with IPython

If IPython is installed, shell_plus uses it automatically. You get syntax colors, tab completion, and command history.

pip install ipython

Tab Completion Saves Time

With IPython you press Tab to autocomplete model and method names. Less typing means fewer mistakes while you explore.

More Than a Shell

django-extensions also adds tools like graph_models to draw your schema. shell_plus is just the most loved one.

Keep It Dev-Only

These extras are development helpers. Put them in your dev requirements so they do not ship to production servers.

Quick Check

What is the main perk of shell_plus?

Recap

You installed django-extensions, launched shell_plus with auto-imported models, viewed SQL, and added IPython for a smoother session. 🚀

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

هل درس «‏shell_plus وأدوات أفضل» مجاني؟

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

ماذا ستتعلم في «‏shell_plus وأدوات أفضل»؟

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

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

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

كم من الوقت يستغرق درس «‏shell_plus وأدوات أفضل»؟

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

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

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

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

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