pallets / quart

An async Python micro framework for building web applications.
https://quart.palletsprojects.com
MIT License
3.01k stars 164 forks source link

Cannot get request files with NGINX #345

Open dm-sizov opened 5 months ago

dm-sizov commented 5 months ago

I can't access the file from request.files even the first time I access it. Without NGINX everything works fine, the configuration does not help. The same code with the same configuration works in Flask.

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/quart/app.py", line 1403, in handle_request
    return await self.full_dispatch_request(request_context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/quart_flask_patch/app.py", line 27, in new_full_dispatch_request
    return await old_full_dispatch_request(self, request_context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/quart/app.py", line 1441, in full_dispatch_request
    result = await self.handle_user_exception(error)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/quart/app.py", line 1029, in handle_user_exception
    raise error
  File "/usr/local/lib/python3.11/site-packages/quart/app.py", line 1439, in full_dispatch_request
    result = await self.dispatch_request(request_context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/quart/app.py", line 1535, in dispatch_request
    return await self.ensure_async(handler)(**request_.view_args)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/quart_auth/globals.py", line 64, in wrapper
    return await current_app.ensure_async(func)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/quart/views.py", line 62, in view
    return await current_app.ensure_async(self.dispatch_request)(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/quart/views.py", line 127, in dispatch_request
    return await current_app.ensure_async(handler)(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/********/*****/*********/*******/views.py", line 360, in post
    file.stream.seek(0)
  File "/usr/local/lib/python3.11/tempfile.py", line 825, in seek
    return self._file.seek(*args)
           ^^^^^^^^^^^^^^^^^^^^^^
ValueError: I/O operation on closed file.

Environment:

evgenii-moriakhin commented 4 months ago

please provide nginx configuration