... トールされているアプリケーションの jinja2 サブディレクトリにあるテンプレートを探します。 OPTIONS の中で最も重要なエントリは 'environment' です。これはJinja2の環境を返す呼び出し可能オブジェクトへのPythonのドット区切りパスです。デフォルトは 'jinja2.Environment' ... ストプロセッサは Django テンプレートで有用です。Jinja2 にはその制限がないので、コンテキストプロセッサとして使う関数を jinja2.Environment を使ってテンプレートのグローバル変数に置くことをお勧めします。そうすれば、テンプレートの中でその関数を呼び出すことができま ... on ( request ) }} いくつかの Django テンプレートコンテキストプロセッサは固定値を返します。Jinja2 テンプレートでは、 jinja2.Environment で直接定数を追加できるので、このような間接的なレイヤーは不要です。 Jinja2用のコンテキストプロセッサを追加する当初のユースケ ... ... 境変数を設定するか、システム全体のライブラリ パスを構成することで設定できます。 LD_LIBRARY_PATH 環境変数 A user may set this environment variable to customize the library paths they want to use. The typical library directory for software built from source is ... ango, you will need to add your OSGeo4W directories to your Windows system Path , as well as create GDAL_DATA and PROJ_LIB environment variables. The following set of commands, executable with cmd.exe , will set this up. Restart your device once this is com ... plete for new environment variables to be recognized: set OSGEO4W_ROOT = C:\OSGeo4W set GDAL_DATA = %OSGEO4W_ROOT% \apps\gdal\share\gdal set PROJ_LI ... ... to write new tests. Running the unit tests Quickstart First, fork Django on GitHub . Second, create and activate a virtual environment. If you're not familiar with how to do that, read our contributing tutorial . Next, clone your fork, install some requirem ... トラブルシューティング for some common issues. Running tests using tox Tox is a tool for running tests in different virtual environments. Django includes a basic tox.ini that automates some checks that our build server performs on pull requests. To run the u ... documentation, the command python3 must be on your path and linked to the appropriate version of Python. A list of default environments can be seen as follows: / $ tox -l py3 black blacken-docs flake8>=3.7.0 docs isort>=7.0.0 lint-docs zizmor>=1.19.0 .. ... ... ew class HomeView ( TemplateView ): template_name = "myapp/home.html" def get_context_data ( self , ** kwargs ): kwargs [ "environment" ] = "Production" return super () . get_context_data ( ** kwargs ) get_context_data() メソッドを直接テストするには、まずビ ... py from django.test import RequestFactory , TestCase from .views import HomeView class HomePageTest ( TestCase ): def test_environment_set_in_context ( self ): request = RequestFactory () . get ( "/" ) view = HomeView () view . setup ( request ) context = v ... iew . get_context_data () self . assertIn ( "environment" , context ) テストとマルチホスト名 ALLOWED_HOSTS 設定はテストを実行する際に検証されます。これによりテストクライアントが内 ... ... to get all these things lined up, and write to the Ops mailing list requesting the required access and permissions. A Unix environment with these tools installed (in alphabetical order): bash (version 4.0+) git GPG make man hashing tools (typically md5sum , ... nd shown below, where you@example.com is the email address associated with the key you want to use. A clean Python virtual environment (Python 3.10+, pip 26.1+) to build artifacts. Access to Django's project on PyPI to upload binaries, ideally with extra pe ... r security issue as follows. (Or, if you lack CNA credentials, email cna@djangoproject.com with a request.) Enable virtual environment with cvelib installed. Export user information: $ export CVE_USER = <user-email>@djangoproject.com CVE_ORG = DSF Reserve: ... ... ses taking more than 20 seconds --max-requests = 5000 \ # respawn processes after serving 5000 requests --vacuum \ # clear environment on exit --home = /path/to/virtual/env \ # optional path to a virtual environment --daemonize = /var/log/uwsgi/yourproject. ... ... it (see Working with Git and GitHub ) Managing multiple versions of Python Python dependency management, including virtual environments The concept of running tests and building documentation If any of these are unfamiliar, see Djangoにはじめて貢献する for ... upstream https://github.com/django/django.git Confirm you're using a compatible version of Python , then set up a virtual environment: $ # This needs to be >= 3.12 $ python -V $ python -m venv ~/.virtualenvs/djangodev $ source ~/.virtualenvs/djangodev/bin/ ... .py See Running the unit tests for more information. While tests will all pass in CI, they may not on every person's local environment. For example, the test suite is only guaranteed to pass on the latest point release of each supported Python version. It's ... ... object doesn't have __reduce__() ( #28389 ). Fixed crash in runserver 's autoreload with Python 2 on Windows with non- str environment variables ( #28174 ). Corrected Field.has_changed() to return False for disabled form fields: BooleanField , MultipleChoic ... ... bmitted address. バグ修正 Fixed a regression in Django 3.0 by restoring the ability to use Django inside Jupyter and other environments that force an async context, by adding an option to disable 非同期安全性 mechanism with DJANGO_ALLOW_ASYNC_UNSAFE environ ... ... トアップすることです。 / $ python manage.py shell ...\> py manage.py shell >>> from django.test.utils import setup_test_environment >>> setup_test_environment () setup_test_environment() は、テンプレートのレンダラーをインストールします。 これによって、今 ... if you instead see an >>> # "Invalid HTTP_HOST header" error and a 400 response, you probably >>> # omitted the setup_test_environment() call described earlier. >>> response . status_code 404 >>> # on the other hand we should expect to find something at '/p ... 2026年10月08日