... 期化されます。ここで、 geodjango プロジェクトの中に world Django アプリケーションを作成します: / $ cd geodjango $ python manage.py startapp world ...\> cd geodjango ...\> py manage.py startapp world settings.py の設定 ¶ geodjango プロジェクトの設定は ... デルを定義した後、データベースと同期する必要があります。まず、データベースマイグレーションを作成してください: / $ python manage.py makemigrations Migrations for 'world': world/migrations/0001_initial.py: + Create model WorldBorder ...\> py manage.py ... ions/0001_initial.py: + Create model WorldBorder WorldBorder モデルのテーブルを生成するSQLを見てみましょう: / $ python manage.py sqlmigrate world 0001 ...\> py manage.py sqlmigrate world 0001 このコマンドを実行すると、次の出力が生成されるはずです: ... ... 期化されます。ここで、 geodjango プロジェクトの中に world Django アプリケーションを作成します: / $ cd geodjango $ python manage.py startapp world ...\> cd geodjango ...\> py manage.py startapp world settings.py の設定 ¶ geodjango プロジェクトの設定は ... デルを定義した後、データベースと同期する必要があります。まず、データベースマイグレーションを作成してください: / $ python manage.py makemigrations Migrations for 'world': world/migrations/0001_initial.py: + Create model WorldBorder ...\> py manage.py ... ions/0001_initial.py: + Create model WorldBorder WorldBorder モデルのテーブルを生成するSQLを見てみましょう: / $ python manage.py sqlmigrate world 0001 ...\> py manage.py sqlmigrate world 0001 このコマンドを実行すると、次の出力が生成されるはずです: ... ... tographic signing , several CSRF improvements , and simple clickjacking protection . An updated default project layout and manage.py that removes the "magic" from prior versions. And for those who don't like the new layout, you can use custom project a ... nds more comprehensively. See the documentation for more details and concrete examples. Updated default project layout and manage.py ¶ Django 1.4 ships with an updated default project layout and manage.py file for the startproject management command. T ... hese fix some issues with the previous manage.py handling of Python import paths that caused double imports, trouble moving from development to deployment, and other di ... ... tographic signing , several CSRF improvements , and simple clickjacking protection . An updated default project layout and manage.py that removes the "magic" from prior versions. And for those who don't like the new layout, you can use custom project a ... nds more comprehensively. See the documentation for more details and concrete examples. Updated default project layout and manage.py ¶ Django 1.4 ships with an updated default project layout and manage.py file for the startproject management command. T ... hese fix some issues with the previous manage.py handling of Python import paths that caused double imports, trouble moving from development to deployment, and other di ... ... ーブルを使うので、使い始める前にデータベースにテーブルを作る必要があります。以下のコマンドを実行してください: / $ python manage.py migrate ...\> py manage.py migrate migrate コマンドは INSTALLED_APPS の設定を参照するとともに、 mysite/settings.py ファ ... れで Django は、 polls アプリケーションが含まれていることを認識できます。もうひとつコマンドを実行しましょう: / $ python manage.py makemigrations polls ...\> py manage.py makemigrations polls 次のようなものが表示されるはずです: Migrations for 'polls' ... を手動で微調整したいというときのために、マイグレーションは人間可読なファイルとして設計されています。 もし興味があれば python manage.py check を実行することもできます; これはマイグレーションを作成したりデータベースにふれることなく、プロジェクトに何か問題が ... ... ーブルを使うので、使い始める前にデータベースにテーブルを作る必要があります。以下のコマンドを実行してください: / $ python manage.py migrate ...\> py manage.py migrate migrate コマンドは INSTALLED_APPS の設定を参照するとともに、 mysite/settings.py ファ ... れで Django は、 polls アプリケーションが含まれていることを認識できます。もうひとつコマンドを実行しましょう: / $ python manage.py makemigrations polls ...\> py manage.py makemigrations polls 次のようなものが表示されるはずです: Migrations for 'polls' ... を手動で微調整したいというときのために、マイグレーションは人間可読なファイルとして設計されています。 もし興味があれば python manage.py check を実行することもできます; これはマイグレーションを作成したりデータベースにふれることなく、プロジェクトに何か問題が ... ... パッケージ名と名前が衝突します) を使わないようにしましょう。 startproject が何を作成したかをみてみましょう: djangotutorial/ manage.py mysite/ __init__.py settings.py urls.py asgi.py wsgi.py ファイルはそれぞれ以下のような役割を持っています: manage.py : D ... jango プロジェクトに対する様々な操作を行うためのコマンドラインユーティリティです。詳しくは django-admin と manage.py 内の manage.py を参照してください。 mysite/ : これは実際のプロジェクト用のPythonパッケージを含むディレクトリです。このデ ... するか確認しましょう。まだであれば、 djangotutorial ディレクトリに移動し、以下のコマンドを実行してください。 / $ python manage.py runserver ...\> py manage.py runserver コマンドライン上で下記の出力が確認できるでしょう: Performing system checks... Sy ... ... パッケージ名と名前が衝突します) を使わないようにしましょう。 startproject が何を作成したかをみてみましょう: djangotutorial/ manage.py mysite/ __init__.py settings.py urls.py asgi.py wsgi.py ファイルはそれぞれ以下のような役割を持っています: manage.py : D ... jango プロジェクトに対する様々な操作を行うためのコマンドラインユーティリティです。詳しくは django-admin と manage.py 内の manage.py を参照してください。 mysite/ : これは実際のプロジェクト用のPythonパッケージを含むディレクトリです。このデ ... するか確認しましょう。まだであれば、 djangotutorial ディレクトリに移動し、以下のコマンドを実行してください。 / $ python manage.py runserver ...\> py manage.py runserver コマンドライン上で下記の出力が確認できるでしょう: Performing system checks... Sy ... ... イートの中で実行した時には失敗してしまうという状況が発生することがあります。 テストの実行 ¶ テストが書けたら、プロジェクトの manage.py ユーティリティの test コマンドでテストが実行できます。 $ ./manage.py test Test discovery is based on the unittest modul ... in test discovery . By default, this will discover tests in any file named test*.py under the current working directory. ./manage.py test に好きな数の「テストラベル」を与えることで、特定のテストを指定することもできます。各テストラベルには、パッケージ、 ... ット区切りの Python パスを指定します。たとえば、以下のように指定します。 # Run all the tests in the animals.tests module $ ./manage.py test animals.tests # Run all the tests found within the 'animals' package $ ./manage.py test animals # Run just one tes ... ... イートの中で実行した時には失敗してしまうという状況が発生することがあります。 テストの実行 ¶ テストが書けたら、プロジェクトの manage.py ユーティリティの test コマンドでテストが実行できます。 $ ./manage.py test Test discovery is based on the unittest modul ... in test discovery . By default, this will discover tests in any file named test*.py under the current working directory. ./manage.py test に好きな数の「テストラベル」を与えることで、特定のテストを指定することもできます。各テストラベルには、パッケージ、 ... ット区切りの Python パスを指定します。たとえば、以下のように指定します。 # Run all the tests in the animals.tests module $ ./manage.py test animals.tests # Run all the tests found within the 'animals' package $ ./manage.py test animals # Run just one tes ... 2026年10月08日