Internal Server Error: /upload/
Traceback (most recent call last):
File "D:\Program Files (x86)\Python38\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "D:\Program Files (x86)\Python38\lib\site-packages\django\core\handlers\base.py", line 179, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\Administrator\PycharmProjects\day06\App\views.py", line 57, in handle_upload
path = os.path.join(path, fobj.name)
AttributeError: 'NoneType' object has no attribute 'name'
[21/Oct/2020 10:31:28] "GET /upload/ HTTP/1.1" 500 63809
Not Found: /favicon.ico
[21/Oct/2020 10:31:29] "GET /favicon.ico HTTP/1.1" 404 4545
是因为这里没写:
if request.method == ‘POST’: