... 使います。 Django はその Python モジュールをロードして、 urlpatterns という名前の変数を探します。この変数の値は django.urls.path() または django.urls.re_path() インスタンスの sequence でなければなりません。 Django は URL パターンを順に調べて、 path_in ... 数として提供されます。 指定された URL パス表現でマッチした名前付き部分からはキーワード引数が作られます。ただし、 django.urls.path() や django.urls.re_path() に kwargs オプション引数が指定されていた場合は、その中の引数で上書きされます。 もし、 URL 正規表 ... ビューを呼び出します。下の Error handling を見てください。 カスタマイズ例 ¶ URLconf のサンプルです。 from django.urls import path from . import views urlpatterns = [ path ( "articles/2003/" , views . special_case_2003 ), path ( "articles/<int:year>/" , ... ... 使います。 Django はその Python モジュールをロードして、 urlpatterns という名前の変数を探します。この変数の値は django.urls.path() または django.urls.re_path() インスタンスの sequence でなければなりません。 Django は URL パターンを順に調べて、 path_in ... 数として提供されます。 指定された URL パス表現でマッチした名前付き部分からはキーワード引数が作られます。ただし、 django.urls.path() や django.urls.re_path() に kwargs オプション引数が指定されていた場合は、その中の引数で上書きされます。 もし、 URL 正規表 ... ビューを呼び出します。下の Error handling を見てください。 カスタマイズ例 ¶ URLconf のサンプルです。 from django.urls import path from . import views urlpatterns = [ path ( "articles/2003/" , views . special_case_2003 ), path ( "articles/<int:year>/" , ... ... = "57 Chevy" ) >>> car . photo <ImageFieldFile: cars/chevy.jpg> >>> car . photo . name 'cars/chevy.jpg' >>> car . photo . path '/media/cars/chevy.jpg' >>> car . photo . url 'https://media.example.com/cars/chevy.jpg' このオブジェクト(例では car.phot ... )からの相対パスを指定することで、ファイル名を変更できます: >>> import os >>> from django.conf import settings >>> initial_path = car . photo . path >>> car . photo . name = "cars/chevy_ii.jpg" >>> new_path = os . path . join ( settings . MEDIA_ROOT ... , car . photo . name ) >>> # Move the file on the filesystem >>> os . rename ( initial_path , new_path ) >>> car . save () >>> car . photo . path '/media/cars/chevy_ii.jpg' >>> car . photo . path == new_path True デ ... ... = "57 Chevy" ) >>> car . photo <ImageFieldFile: cars/chevy.jpg> >>> car . photo . name 'cars/chevy.jpg' >>> car . photo . path '/media/cars/chevy.jpg' >>> car . photo . url 'https://media.example.com/cars/chevy.jpg' このオブジェクト(例では car.phot ... )からの相対パスを指定することで、ファイル名を変更できます: >>> import os >>> from django.conf import settings >>> initial_path = car . photo . path >>> car . photo . name = "cars/chevy_ii.jpg" >>> new_path = os . path . join ( settings . MEDIA_ROOT ... , car . photo . name ) >>> # Move the file on the filesystem >>> os . rename ( initial_path , new_path ) >>> car . save () >>> car . photo . path '/media/cars/chevy_ii.jpg' >>> car . photo . path == new_path True デ ... ... : from django.urls import include , path urlpatterns = [ path ( "index/" , views . index , name = "main-view" ), path ( "bio/<username>/" , views . bio , name = "b ... io" ), path ( "articles/<slug:title>/" , views . article , name = "article-detail" ), path ( "articles/<slug:title>/<int:section>/" , ... views . section , name = "article-section" ), path ( "blog/" , include ( "blog.urls" )), ... , ] route ¶ The route argument should be a string or gettext_lazy() (see URL パタ ... ... : from django.urls import include , path urlpatterns = [ path ( "index/" , views . index , name = "main-view" ), path ( "bio/<username>/" , views . bio , name = "b ... io" ), path ( "articles/<slug:title>/" , views . article , name = "article-detail" ), path ( "articles/<slug:title>/<int:section>/" , ... views . section , name = "article-section" ), path ( "blog/" , include ( "blog.urls" )), ... , ] route ¶ The route argument should be a string or gettext_lazy() (see URL パタ ... ... リのパスは、個々のユーザーごとに環境変数を設定するか、システム全体のライブラリ パスを構成することで設定できます。 LD_LIBRARY_PATH 環境変数 ¶ A user may set this environment variable to customize the library paths they want to use. The typical library d ... irectory for software built from source is /usr/local/lib . Thus, /usr/local/lib needs to be included in the LD_LIBRARY_PATH variable. For example, the user could place the following in their bash profile: export LD_LIBRARY_PATH = /usr/local/lib シ ... イブラリのパスを設定する ¶ On GNU/Linux systems, there is typically a file in /etc/ld.so.conf , which may include additional paths from files in another directory, such as /etc/ld.so.conf.d . As the root user, add the custom library path (like /usr/loc ... ... リのパスは、個々のユーザーごとに環境変数を設定するか、システム全体のライブラリ パスを構成することで設定できます。 LD_LIBRARY_PATH 環境変数 ¶ A user may set this environment variable to customize the library paths they want to use. The typical library d ... irectory for software built from source is /usr/local/lib . Thus, /usr/local/lib needs to be included in the LD_LIBRARY_PATH variable. For example, the user could place the following in their bash profile: export LD_LIBRARY_PATH = /usr/local/lib シ ... イブラリのパスを設定する ¶ On GNU/Linux systems, there is typically a file in /etc/ld.so.conf , which may include additional paths from files in another directory, such as /etc/ld.so.conf.d . As the root user, add the custom library path (like /usr/loc ... ... _wsgiをインストールして有効にしたら、Apacheサーバーの httpd.conf ファイルを編集して、以下を追加します。 WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py WSGIPythonHome /path/to/venv WSGIPythonPath /path/to/mysite.com <Directory /path/to/mysite.co ... 場合は、 WSGIPythonHome を使ってパスを追加します。詳しくは mod_wsgi virtual environment guide を参照してください。 WSGIPythonPath の行は、プロジェクトのパッケージは Python のパス上でインポートすることが可能であることを保証します。言い換えると、 import ... な WSGIDaemonProcess と WSGIProcessGroup ディレクティブを追加する必要があります。デーモンモードを使用する場合には WSGIPythonPath を使用できないため、上記設定にさらなる変更が求められます。代わりに WSGIDaemonProcess に python-path オプションを使用する必 ... ... _wsgiをインストールして有効にしたら、Apacheサーバーの httpd.conf ファイルを編集して、以下を追加します。 WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py WSGIPythonHome /path/to/venv WSGIPythonPath /path/to/mysite.com <Directory /path/to/mysite.co ... 場合は、 WSGIPythonHome を使ってパスを追加します。詳しくは mod_wsgi virtual environment guide を参照してください。 WSGIPythonPath の行は、プロジェクトのパッケージは Python のパス上でインポートすることが可能であることを保証します。言い換えると、 import ... な WSGIDaemonProcess と WSGIProcessGroup ディレクティブを追加する必要があります。デーモンモードを使用する場合には WSGIPythonPath を使用できないため、上記設定にさらなる変更が求められます。代わりに WSGIDaemonProcess に python-path オプションを使用する必 ... 2026年10月08日