Mar-28-2024, 01:46 PM
(This post was last modified: Mar-28-2024, 01:46 PM by Username_Python1.)
Hello everyone,
I would like to use the Flask framework to make a file upload over the internet. Locally over my home network and the localhost, the upload works without errors. But if I use the public IP the file dont copy to my server and I got the error message which you can see below. I'm using the versions Python 3.7.3, Apache 2 server and the Raspberry IOS Debian 10.13 OS.
I've already tried a few things at the code, even the solution with the os module at memory path (file.save(os.path. …)), but this also does not worked.
I'm looking forward to an answers from you. Thank you.
I got the following error message:
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] [DATE] ERROR in app: Exception on /upload [POST]
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] Traceback (most recent call last):
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 2292, in wsgi_app
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] response = self.full_dispatch_request()
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 1815, in full_dispatch_request
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] rv = self.handle_user_exception(e)
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 1718, in handle_user_exception
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] reraise(exc_type, exc_value, tb)
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/_compat.py", line 35, in reraise
[DATE [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] raise value
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 1813, in full_dispatch_request
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] rv = self.dispatch_request()
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 1799, in dispatch_request
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] return self.view_functions[rule.endpoint](**req.view_args)
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/var/www/app/app.py", line 17, in upload
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] file.save('uploads/{file.filename}')
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/werkzeug/datastructures.py", line 2725, in save
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] dst = open(dst, 'wb')
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] FileNotFoundError: [Errno 2] No such file or directory: 'uploads/{file.filename}'
Greeting UP1
I would like to use the Flask framework to make a file upload over the internet. Locally over my home network and the localhost, the upload works without errors. But if I use the public IP the file dont copy to my server and I got the error message which you can see below. I'm using the versions Python 3.7.3, Apache 2 server and the Raspberry IOS Debian 10.13 OS.
I've already tried a few things at the code, even the solution with the os module at memory path (file.save(os.path. …)), but this also does not worked.
I'm looking forward to an answers from you. Thank you.
I got the following error message:
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] [DATE] ERROR in app: Exception on /upload [POST]
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] Traceback (most recent call last):
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 2292, in wsgi_app
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] response = self.full_dispatch_request()
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 1815, in full_dispatch_request
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] rv = self.handle_user_exception(e)
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 1718, in handle_user_exception
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] reraise(exc_type, exc_value, tb)
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/_compat.py", line 35, in reraise
[DATE [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] raise value
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 1813, in full_dispatch_request
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] rv = self.dispatch_request()
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 1799, in dispatch_request
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] return self.view_functions[rule.endpoint](**req.view_args)
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/var/www/app/app.py", line 17, in upload
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] file.save('uploads/{file.filename}')
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/werkzeug/datastructures.py", line 2725, in save
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] dst = open(dst, 'wb')
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] FileNotFoundError: [Errno 2] No such file or directory: 'uploads/{file.filename}'
Greeting UP1