... under ASGI . Async views will still work under WSGI, but with a small per-request adaptation cost (see パフォーマンス ), and without the abil ... ity to have efficient long-running requests. Many parts of Django provide asynchronous APIs, including the ORM , the cache framework, authentication, sessions, and signals. For other code, the sync_to_a ... sync() adapter is a low-cost bridge (see パフォーマンス ). A wide range of async-native Python libraries can also be integrated. 非同期ビュー ¶ どのようなビューでも、呼び出し可能オブジェクトでコルーチンを ... ... under ASGI . Async views will still work under WSGI, but with a small per-request adaptation cost (see パフォーマンス ), and without the abil ... ity to have efficient long-running requests. Many parts of Django provide asynchronous APIs, including the ORM , the cache framework, authentication, sessions, and signals. For other code, the sync_to_a ... sync() adapter is a low-cost bridge (see パフォーマンス ). A wide range of async-native Python libraries can also be integrated. 非同期ビュー ¶ どのようなビューでも、呼び出し可能オブジェクトでコルーチンを ... ... グ関数は一致する必要があります。ミドルウェアがこの種のイテレータをサポートする必要がある場合には、 StreamingHttpResponse.is_async 確認してください。 例外のハンドリング ¶ Django はビューまたはミドルウェアによって起こされた例外を、エラーステータスコードを ... エストのみを処理できると想定します。この前提を変更するには、ミドルウェア ファクトリ関数またはクラスに次の属性を設定します。 sync_capable は、ミドルウェアが同期リクエストを処理できるかどうかを表すブール値です。デフォルトは True 。 async_capable は、ミド ... ルウェアが非同期リクエストを処理できるかどうかを表すブール値です。デフォルトは False 。 If your middleware has both sync_capable = True and async_capable = True , then Django will pass it the request without converting it. In this case, you ca ... ... グ関数は一致する必要があります。ミドルウェアがこの種のイテレータをサポートする必要がある場合には、 StreamingHttpResponse.is_async 確認してください。 例外のハンドリング ¶ Django はビューまたはミドルウェアによって起こされた例外を、エラーステータスコードを ... エストのみを処理できると想定します。この前提を変更するには、ミドルウェア ファクトリ関数またはクラスに次の属性を設定します。 sync_capable は、ミドルウェアが同期リクエストを処理できるかどうかを表すブール値です。デフォルトは True 。 async_capable は、ミド ... ルウェアが非同期リクエストを処理できるかどうかを表すブール値です。デフォルトは False 。 If your middleware has both sync_capable = True and async_capable = True , then Django will pass it the request without converting it. In this case, you ca ... ... 引数が追加される可能性があり、レシーバはその新しい引数を扱えなければならないからです。 レシーバーは同じシグネチャーを持ち、 async def を使って宣言された非同期関数になることもできます: async def my_receiver ( sender , ** kwargs ): await asyncio . sleep ... 返されるエラーの __traceback__ 属性に存在します。 asend() は send() と似ていますが、await しなければならないコルーチンです: async def asend_pizza ( self , toppings , size ): await pizza_done . asend ( sender = self . __class__ , toppings = toppings , s ... ize = size ) ... Whether synchronous or asynchronous, receivers will be correctly adapted to whether send() or asend() is used. Synchronous receivers wi ... ... 引数が追加される可能性があり、レシーバはその新しい引数を扱えなければならないからです。 レシーバーは同じシグネチャーを持ち、 async def を使って宣言された非同期関数になることもできます: async def my_receiver ( sender , ** kwargs ): await asyncio . sleep ... 返されるエラーの __traceback__ 属性に存在します。 asend() は send() と似ていますが、await しなければならないコルーチンです: async def asend_pizza ( self , toppings , size ): await pizza_done . asend ( sender = self . __class__ , toppings = toppings , s ... ize = size ) ... Whether synchronous or asynchronous, receivers will be correctly adapted to whether send() or asend() is used. Synchronous receivers wi ... ... ードを変更している場合、ソケットがクリーンに閉じられるように、中断されたリクエストに遭遇した際にはこれを発生させるべきです。 SynchronousOnlyOperation ¶ exception SynchronousOnlyOperation [ソース] ¶ SynchronousOnlyOperation 例外は、同期的な Python コード ... スレッドから同期専用のコードを呼び出そうとしている場合は、同期スレッドを作成し、その中で呼び出してください。これは、 asgiref.sync.sync_to_async() を使用して実現できます。 URL Resolver の例外 ¶ URL Resolver の例外は django.urls で定義されています。 Reso ... lewareNotUsed ImproperlyConfigured FieldError FieldFetchBlocked ValidationError NON_FIELD_ERRORS BadRequest RequestAborted SynchronousOnlyOperation URL Resolver の例外 Resolver404 NoReverseMatch データベースの例外 HTTP 例外 UnreadablePostError セッシ ... ... where alogin() and alogout() did not respectively set or clear request.user if it had already been materialized (e.g., by sync middleware) ( #37017 ). Fixed a regression in Django 6.0 in admin forms where RelatedFieldWidgetWrapper incorrectly wrappe ... ... ードを変更している場合、ソケットがクリーンに閉じられるように、中断されたリクエストに遭遇した際にはこれを発生させるべきです。 SynchronousOnlyOperation ¶ exception SynchronousOnlyOperation [ソース] ¶ SynchronousOnlyOperation 例外は、同期的な Python コード ... スレッドから同期専用のコードを呼び出そうとしている場合は、同期スレッドを作成し、その中で呼び出してください。これは、 asgiref.sync.sync_to_async() を使用して実現できます。 URL Resolver の例外 ¶ URL Resolver の例外は django.urls で定義されています。 Reso ... lewareNotUsed ImproperlyConfigured FieldError FieldFetchBlocked ValidationError NON_FIELD_ERRORS BadRequest RequestAborted SynchronousOnlyOperation URL Resolver の例外 Resolver404 NoReverseMatch データベースの例外 HTTP 例外 UnreadablePostError セッシ ... ... where alogin() and alogout() did not respectively set or clear request.user if it had already been materialized (e.g., by sync middleware) ( #37017 ). Fixed a regression in Django 6.0 in admin forms where RelatedFieldWidgetWrapper incorrectly wrappe ... 2026年10月08日