shell_plus e strumenti migliori
Velocizzi il lavoro nella shell con django-extensions
shell_plus e strumenti migliori è una lezione Django Academy gratuita su CoddyKit. Questa è la lezione 4 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Django Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Django Academy include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
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-extensionsRegister 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_plusModels 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-sqlNicer with IPython
If IPython is installed, shell_plus uses it automatically. You get syntax colors, tab completion, and command history.
pip install ipythonTab 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. 🚀
Domande Frequenti
La lezione «shell_plus e strumenti migliori» è gratuita?
Sì — il testo completo di «shell_plus e strumenti migliori» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Django Academy, passa a CoddyKit PRO. Il corso Django Academy include 4 lezioni in totale.
Cosa imparerò in «shell_plus e strumenti migliori»?
Velocizzi il lavoro nella shell con django-extensions Eserciti Django Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Django Academy?
Non è richiesta alcuna esperienza precedente. Django Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 4 di 4.
Quanto tempo richiede la lezione «shell_plus e strumenti migliori»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Django Academy?
Sì. Ogni lezione Django Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Avviare python manage.py shell
- Importare e ispezionare i modelli
- Creare e salvare oggetti in tempo reale
- shell_plus e strumenti migliori