0Pricing
Django Academy · レッスン

startappとアプリフォルダーの構成

アプリ内に生成される各ファイルの役割を学びます

「startappとアプリフォルダーの構成」はCoddyKit上の無料Django Academyレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはDjango Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Django Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

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. 🎉

よくある質問

「startappとアプリフォルダーの構成」レッスンは無料ですか?

はい。「startappとアプリフォルダーの構成」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Django Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Django Academyコースには全4レッスンが含まれています。

「startappとアプリフォルダーの構成」で何を学びますか?

アプリ内に生成される各ファイルの役割を学びます ブラウザで直接実行するハンズオンコードでDjango Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Django Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのDjango Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。

「startappとアプリフォルダーの構成」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このDjango Academyレッスンでコードを書いて実行できますか?

はい。すべてのDjango Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. startappとアプリフォルダーの構成
  2. INSTALLED_APPSにアプリを登録する
  3. settings.pyを見て回る
  4. manage.py:コマンドセンター
← Django Academyに戻る