... min を使用しますが、実行例は全て manage.py もしくは python -m django でも同様に利用可能です。 使い方 / $ django-admin <command> [ options ] $ manage.py <command> [ options ] $ python -m django <command> [ options ] ...\> django-admin < command > [op ... tions] ...\> manage.py < command > [options] ...\> py -m django < command > [options] command にはこのドキュメントに一覧されたコマンドの1つでなければなりま ... dmin help を実行すると、使用方法の情報と、各アプリケーションが提供するコマンドのリストが表示されます。 django-admin help --commands を実行すると、利用可能な全てのコマンドの一覧が表示されます。 django-admin help <command> を実行すると、与えられたコマンド ... ... rsion is 3.0 or later. The PostGIS 2 CREATE EXTENSION postgis and the SpatiaLite SELECT InitSpatialMetaData initialization commands are now automatically run by migrate . The GDAL interface now supports retrieving properties of raster (image) data file ... ail() method to make it more subclass friendly. 管理コマンド Database connections are now always closed after a management command called from the command line has finished doing its job. Commands from alternate package formats like eggs are now also di ... Meta.unique_together . It is also able to introspect AutoField for MySQL and PostgreSQL databases. When calling management commands with options using call_command() , the option name can match the command line option name (without the initial dashes) o ... ... as been deprecated and replaced by migrate . Don't worry - calls to syncdb will still work as before. A new makemigrations command provides an easy way to autodetect changes to your models and make migrations for them. django.db.models.signals.pre_syncd ... ble so you can add your own checks for your own apps and libraries. To perform system checks, you use the check management command. This command replaces the older validate management command. New Prefetch object for advanced prefetch_related operations ... e name (e.g. css/styles.55e7cbb9ba48.css ). The staticfiles.json file is created when running the collectstatic management command and should be a less expensive alternative for remote storages such as Amazon S3. See the ManifestStaticFilesStorage docs ... ... HStoreField は key と value を文字列にキャストするようになりました。 django.contrib.sessions The clearsessions management command now removes file-based sessions. django.contrib.sites The Site model now supports natural keys . django.contrib.staticfile ... s translation domain from all installed apps rather than only the JavaScript strings from LOCALE_PATHS . 管理コマンド call_command() now returns the value returned from the command.handle() method. The new check --fail-level option allows specifying the ... message level that will cause the command to exit with a non-zero status. The new makemigrations --check option makes the command exit with a non-zero status when m ... ... 加したり、特定のモジュールをプリロードしたりできます。そのためには、 django.core.management.commands.shell.Command のサブクラスを作成し、既存の shell 管理コマンドをオーバーライドする新しい管理コマンドを作成します。詳細につ ... ケーションで利用可能なオブジェクトまたはモジュールのインポートパスのシーケンスを返す必要があります。例えば: polls/management/commands/shell.py from django.core.management.commands import shell class Command ( shell . Command ): def get_auto_imports ( self ... てください。自動インポートを恒久的に無効にするには、 get_auto_imports() をオーバーライドして None を返すようにします: class Command ( shell . Command ): def get_auto_imports ( self ): return None ... ... -m pip install sphinx-autobuild ...\> py -m pip install sphinx-autobuild From the docs directory, run one of the following commands: On Linux and macOS: $ SPHINXBUILD = sphinx-autobuild SPHINXOPTS = "--open-browser --delay 0" make html On Windows (Comma ... n automatically in CI and must pass before documentation changes can be merged. They can also be run locally with a single command: / $ make check ...\> make.bat check This command runs all current checks and will include any new checks added in the ... -commit hook if configured. The check can also be run manually: provided that blacken-docs is installed, run the following command from the docs directory: / $ make black ...\> make.bat black The formatter will report any issues by printing them to ... ... ル で作成した polls アプリケーションに独自の closepoll コマンドを追加します。 独自のコマンドを追加するためには、 management/commands ディレクトリをアプリケーションに追加してください。Djangoは、そのディレクトリ内のアンダーバーで始まらないPythonモジュールす ... べてを manage.py コマンドに登録します。例えば: polls/ __init__.py models.py management/ __init__.py commands/ __init__.py _private.py closepoll.py tests.py views.py この例では、 closepoll コマンドは polls アプリケーションを INSTAL ... y モジュールは管理コマンドとして利用できません。 closepoll.py モジュールには一つだけ満たすべき要件があります。それは、 BaseCommand クラスもしくはその サブクラス の一つを継承した Command クラスを定義することです。 スタンドアロンのスクリプト カスタム管理コ ... ... d minimizing overall admin media file size. JavaScript tests Django's JavaScript tests can be run in a browser or from the command line. The tests are located in a top level js_tests directory. テストを書く Django's JavaScript tests use QUnit . Here is ... n the types of assertions supported by QUnit . テストの実行 The JavaScript tests may be run from a web browser or from the command line. Testing from a web browser To run the tests from a web browser, open up js_tests/tests.html in your browser. To meas ... てください。( js_tests の中ではなく) Open http://localhost:8000/js_tests/tests.html in your web browser. Testing from the command line To run the tests from the command line, you need to have Node.js installed. After installing Node.js , install the Ja ... ... grate コマンドラインオプション optimizemigration コマンドラインオプション --clear collectstatic コマンドラインオプション --command shell コマンドラインオプション --database changepassword コマンドラインオプション check コマンドラインオプション createcac ... ソッド) (GeometryCollection のメソッド) (RelatedManager のメソッド) add_action() (AdminSite のメソッド) add_arguments() (BaseCommand のメソッド) (DiscoverRunner のクラスメソッド) add_constraint() (BaseDatabaseSchemaEditor のメソッド) add_error() (Form のメ ... の属性) app_label (ContentType の属性) (Options の属性) app_name (ResolverMatch の属性) app_names (ResolverMatch の属性) AppCommand (django.core.management のクラス) AppConfig (django.apps のクラス) APPEND_SLASH setting appendlist() (QueryDict のメソッド ... ... t and manage.py Django 1.4 ships with an updated default project layout and manage.py file for the startproject management command. These fix some issues with the previous manage.py handling of Python import paths that caused double imports, trouble mov ... . setdefault ( "DJANGO_SETTINGS_MODULE" , "{{ project_name }}.settings" ) from django.core.management import execute_from_command_line execute_from_command_line ( sys . argv ) {{ project_name }} should be replaced with the Python package name of the ac ... cleaned up when switching to the new manage.py . Custom project and app templates The startapp and startproject management commands now have a --template option for specifying a path or URL to a custom app or project template. For example, Django will u ... 2026年10月08日