Skip to content

ERROR: Exception in ASGI application for webapps -> fastapi -> uvicorn #9

@jiapei100

Description

@jiapei100
fastapi git:(master) ✗ uvicorn app:app --reload
INFO:     Will watch for changes in these directories: ['~/....../python-fun/webapps/fastapi']
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [2387967] using watchgod
INFO:     Started server process [2387969]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     127.0.0.1:58440 - "GET / HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "~/.local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 372, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "~/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/fastapi/applications.py", line 259, in __call__
    await super().__call__(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/applications.py", line 119, in __call__
    await self.middleware_stack(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "~/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "~/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 87, in __call__
    raise exc
  File "~/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 76, in __call__
    await self.app(scope, receive, sender)
  File "~/.local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "~/.local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 659, in __call__
    await route.handle(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "~/.local/lib/python3.8/site-packages/fastapi/routing.py", line 216, in app
    solved_result = await solve_dependencies(
  File "~/.local/lib/python3.8/site-packages/fastapi/dependencies/utils.py", line 465, in solve_dependencies
    response = response or Response(
  File "~/.local/lib/python3.8/site-packages/starlette/responses.py", line 50, in __init__
    self.init_headers(headers)
  File "~/.local/lib/python3.8/site-packages/starlette/responses.py", line 77, in init_headers
    and not (self.status_code < 200 or self.status_code in (204, 304))
TypeError: '<' not supported between instances of 'NoneType' and 'int'
INFO:     127.0.0.1:58442 - "GET /favicon.ico HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:58444 - "GET / HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "~/.local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 372, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "~/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/fastapi/applications.py", line 259, in __call__
    await super().__call__(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/applications.py", line 119, in __call__
    await self.middleware_stack(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "~/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "~/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 87, in __call__
    raise exc
  File "~/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 76, in __call__
    await self.app(scope, receive, sender)
  File "~/.local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "~/.local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 659, in __call__
    await route.handle(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "~/.local/lib/python3.8/site-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "~/.local/lib/python3.8/site-packages/fastapi/routing.py", line 216, in app
    solved_result = await solve_dependencies(
  File "~/.local/lib/python3.8/site-packages/fastapi/dependencies/utils.py", line 465, in solve_dependencies
    response = response or Response(
  File "~/.local/lib/python3.8/site-packages/starlette/responses.py", line 50, in __init__
    self.init_headers(headers)
  File "~/.local/lib/python3.8/site-packages/starlette/responses.py", line 77, in init_headers
    and not (self.status_code < 200 or self.status_code in (204, 304))
TypeError: '<' not supported between instances of 'NoneType' and 'int'
^CINFO:     Shutting down
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [2387969]
INFO:     Stopping reloader process [2387967]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions