0Pricing
Django Academy · Lezione

startapp e struttura della cartella dell'app

Scopra a cosa serve ogni file generato nell'app

startapp e struttura della cartella dell'app è una lezione Django Academy gratuita su CoddyKit. Questa è la lezione 1 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.

Apps Are the Building Blocks

A Django project is made of small, focused pieces called apps. Each app handles one feature, like a blog or a shop. 🧱

Create One with startapp

You make a new app with the startapp command. Django generates a ready-to-edit folder so you never start from a blank page.

python manage.py startapp blog

The App Folder Appears

That command drops a blog/ folder next to manage.py. Inside are several files, each with one clear job that you will meet next.

models.py Holds Your Data

The models.py file is where you describe your data as Python classes. Each class becomes a database table later on.

class Post(models.Model):
    title = models.CharField(max_length=200)

views.py Handles Requests

The views.py file holds the logic that runs when a page is requested. A view takes a request and returns a response.

def home(request):
    return HttpResponse("Hello")

admin.py Powers the Admin

The admin.py file lets you register models so they show up in Django's built-in admin site for easy editing.

admin.site.register(Post)

apps.py Names the App

The apps.py file holds a small config class that gives your app its name and settings. You rarely touch it at first.

class BlogConfig(AppConfig):
    name = "blog"

tests.py for Confidence

The tests.py file is where your automated tests live. Writing tests here helps you change code without breaking things.

The migrations Folder

The migrations folder tracks how your database structure changes over time. Django fills it in automatically as your models evolve.

No urls.py Yet

Notice startapp does not create a urls.py for the app. You add one yourself when you want to route pages to your views.

Apps Are Reusable

Because each app is self-contained, you can lift a well-made app out of one project and drop it into another with little effort. ♻️

Quick Check

Which file does startapp create for your data models?

Recap: You Mapped an App

You ran startapp and learned each file's job: models for data, views for logic, admin and apps for config. Apps keep features tidy and reusable. 🎉

Domande Frequenti

La lezione «startapp e struttura della cartella dell'app» è gratuita?

Sì — il testo completo di «startapp e struttura della cartella dell'app» è 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 «startapp e struttura della cartella dell'app»?

Scopra a cosa serve ogni file generato nell'app 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 1 di 4.

Quanto tempo richiede la lezione «startapp e struttura della cartella dell'app»?

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

  1. startapp e struttura della cartella dell'app
  2. Registrare le app in INSTALLED_APPS
  3. Esplorare settings.py
  4. manage.py: il Suo centro di comando
← Torna a Django Academy