AttributeError: ‘NoneType‘ object has no attribute ‘name‘
程序员文章站
2024-03-25 11:28:04
...
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’:
推荐阅读
-
Django 报错:‘AttributeError: ‘str‘ object has no attribute ‘decode‘‘
-
AttributeError: ‘NoneType‘ object has no attribute ‘name‘
-
【已解决】python-pip升级报错- AttributeError: 'NoneType' object has no attribute 'bytes'
-
AttributeError: ‘str‘ object has no attribute ‘decode‘ Python3
-
Django2.2报错::AttributeError: ''str'' object has no attribute ''decode''
-
报错:AttributeError: module 'cv2.cv2' has no attribute 'xfeatures2d'
-
pip 升级问题 'NoneType' object has no attribute 'bytes' 博客分类: python
-
Python3下错误AttributeError: ‘dict’ object has no attribute’iteritems‘的分析与解决
-
Python3下错误AttributeError: ‘dict’ object has no attribute’iteritems‘的分析与解决
-
AttributeError: 'dict' object has no attribute 'has_key'