FO: Will watch for changes in these directories: ['E:\\python\\Python313\\fastapi\\ORM系统']
INFO: Uvicorn running on http://127.0.0.1:8080 (Press CTRL+C to quit)
INFO: Started reloader process [8364] using StatReload
INFO: Started server process [12812]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: 127.0.0.1:63944 - "GET /docs HTTP/1.1" 200 OK
INFO: 127.0.0.1:63944 - "GET /openapi.json HTTP/1.1" 200 OK
INFO: 127.0.0.1:63944 - "GET /student/ HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
self.scope, self.receive, self.send
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 60, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\fastapi\applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\starlette\applications.py", line 112, in __call__
await self.middleware_stack(scope, receive, send)
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\starlette\middleware\errors.py", line 187, in __call__
raise exc
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\starlette\middleware\errors.py", line 165, in __call__
await self.app(scope, receive, _send)
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app
raise exc
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\starlette\routing.py", line 714, in __call__
await self.middleware_stack(scope, receive, send)
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\starlette\routing.py", line 734, in app
await route.handle(scope, receive, send)
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\starlette\routing.py", line 288, in handle
await self.app(scope, receive, send)
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\starlette\routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app
raise exc
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\starlette\routing.py", line 73, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\fastapi\routing.py", line 301, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
)
^
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\fastapi\routing.py", line 212, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\python\Python313\fastapi\ORM系统\api\students.py", line 26, in get_all_students
stu1 = await Students.filter(sno__gt=2003)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\tortoise\models.py", line 1323, in filter
return cls._meta.manager.get_queryset().filter(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\tortoise\manager.py", line 19, in get_queryset
return QuerySet(self._model)
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\tortoise\queryset.py", line 337, in __init__
super().__init__(model)
~~~~~~~~~~~~~~~~^^^^^^^
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\tortoise\queryset.py", line 99, in __init__
self.capabilities: Capabilities = model._meta.db.capabilities
^^^^^^^^^^^^^^
File "E:\python\Python313\fastapi\.venv\Lib\site-packages\tortoise\models.py", line 280, in db
raise ConfigurationError(
f"default_connection for the model {self._model} cannot be None"
)
tortoise.exceptions.ConfigurationError: default_connection for the model <class 'ORM系统.models.Students'> cannot be None
最新发布