django/core/checks/async_checks.py
raw| 1 | import os |
| 2 | |
| 3 | from . import Error, Tags, register |
| 4 | |
| 5 | E001 = Error( |
| 6 | "You should not set the DJANGO_ALLOW_ASYNC_UNSAFE environment variable in " |
| 7 | "deployment. This disables async safety protection.", |
| 8 | id="async.E001", |
| 9 | ) |
| 10 | |
| 11 | |
| 12 | @register(Tags.async_support, deploy=True) |
| 13 | def check_async_unsafe(app_configs, **kwargs): |
| 14 | if os.environ.get("DJANGO_ALLOW_ASYNC_UNSAFE"): |
| 15 | return [E001] |
| 16 | return [] |