Skip to content

Django 4.0 ASGI lifespan error #615

Open
@travisbell

Description

@travisbell

Hi guys,

I'm completely new to getting Python up and running with Unit and if this is actually just a Django error, please let me know but I did simply follow the docs and am seeing the below error on a completely fresh Python 3.10 + Django 4.0 app:

2021/12/09 18:17:56 [info] 233#233 "python" application started
2021/12/09 18:17:56 [info] 0#233 [unit] ASGI Lifespan processing exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/django/core/handlers/asgi.py", line 143, in __call__
    raise ValueError(
ValueError: Django can only handle ASGI/HTTP connections, not lifespan.
2021/12/09 18:17:56 [info] 233#234 [unit] ASGI Lifespan processing exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/django/core/handlers/asgi.py", line 143, in __call__
    raise ValueError(
ValueError: Django can only handle ASGI/HTTP connections, not lifespan.

Is this a Unit problem, or a Django problem? Django 4.0 was just released so maybe it's just a compatibility problem with 4.0?

Starting Unit with the wsgi handler works fine, no errors. Config is simple:

"python": {
  "type": "python",
  "path": "/path/to/project/django_example",
  "module": "django_example.asgi",
  "callable": "application"
}

Thanks!

Metadata

Metadata

Assignees

Labels

z-Difficulty: ⭐️Difficulty: EASY. Effects an isolated area of the codebase.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions