TypeError: WSGIHandler.__call__() missing 1 required positional argument: 'start_response' #2186
Unanswered
kushalmraut
asked this question in
Q&A
Replies: 1 comment
-
SOMEONE EXPLAIN THIS ERROR |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
versions:
I was geting TypeError: WSGIHandler.call() missing 1 required positional argument: 'start_response' after specifying specifying
uvicorn.workers.UvicornWorker
gunicorn config:
[2023-12-15 05:35:43 +0000] [24090] [INFO] ASGI 'lifespan' protocol appears unsupported.
[2023-12-15 05:35:43 +0000] [24090] [INFO] Application startup complete.
[2023-12-15 05:35:43 +0000] [24085] [INFO] Started server process [24085]
[2023-12-15 05:35:43 +0000] [24085] [INFO] Waiting for application startup.
[2023-12-15 05:35:43 +0000] [24085] [INFO] ASGI 'lifespan' protocol appears unsupported.
[2023-12-15 05:35:43 +0000] [24085] [INFO] Application startup complete.
[2023-12-15 05:36:18 +0000] [24085] [ERROR] Exception in ASGI application
Traceback (most recent call last):
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/uvicorn/middleware/asgi2.py", line 16, in call
instance = self.app(scope)
^^^^^^^^^^^^^^^
TypeError: WSGIHandler.call() missing 1 required positional argument: 'start_response'
after that i referred this links with similar issue
#1495
#483
after referring these I specified project.asgi:application instated on project.wsgi:application in gunicorn config i am getting bellow error.
[log.py:241 - log_response()] OK: /
Traceback (most recent call last):
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/asgiref/sync.py", line 534, in thread_handler
raise exc_info[1]
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/core/handlers/exception.py", line 42, in inner
response = await get_response(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/core/handlers/base.py", line 235, in _get_response_async
callback, callback_args, callback_kwargs = self.resolve_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/core/handlers/base.py", line 313, in resolve_request
resolver_match = resolver.resolve(request.path_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/urls/resolvers.py", line 663, in resolve
for pattern in self.url_patterns:
^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/utils/functional.py", line 57, in get
res = instance.dict[self.name] = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/urls/resolvers.py", line 715, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/utils/functional.py", line 57, in get
res = instance.dict[self.name] = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
return import_module(self.urlconf_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1149, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/home/anahit_web/anahit_website/app/anahit/urls.py", line 38, in
path("blog/", include("blog.urls")),
^^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/urls/conf.py", line 38, in include
urlconf_module = import_module(urlconf_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1149, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/home/anahit_web/anahit_website/app/apps/blog/urls.py", line 3, in
from . import views
File "/home/anahit_web/anahit_website/app/apps/blog/views.py", line 19, in
current_site = Site.objects.get_current()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/contrib/sites/models.py", line 59, in get_current
return self._get_site_by_id(site_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/contrib/sites/models.py", line 30, in _get_site_by_id
site = self.get(pk=site_id)
^^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/db/models/query.py", line 633, in get
num = len(clone)
^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/db/models/query.py", line 380, in len
self._fetch_all()
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/db/models/query.py", line 1881, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/db/models/query.py", line 91, in iter
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1560, in execute_sql
cursor = self.connection.cursor()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/anahit_web/venv_311/lib/python3.11/site-packages/django/utils/asyncio.py", line 24, in inner
raise SynchronousOnlyOperation(message)
django.core.exceptions.SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async.
Beta Was this translation helpful? Give feedback.
All reactions