我尝试登录管理页面,但显示了此错误...
连接MySQL和Django
使用引擎mysql.connector.django。 (Othere Engine无法连接mysql :(我试过..)
迁移是成功的。
AttributeError at /admin/login/
'datetime.datetime' object has no attribute 'split'
Request Method: POST
Request URL: http://localhost:8000/admin/login/?next=/admin/
Django Version: 2.0.5
Exception Type: AttributeError
Exception Value:
'datetime.datetime' object has no attribute 'split'
我的pip冻结在这里。
certifi==2018.4.16
Django==2.0.5
mysql-connector-python==8.0.11
mysqlclient==1.3.12
pipenv==2018.5.18
psycopg2-binary==2.7.4
PyMySQL==0.8.1
pytz==2018.4
virtualenv==16.0.0
virtualenv-clone==0.3.0
whitenoise==3.3.1
我猜MySQL不支持最新的django版本,是吗?
所有追溯都在这里!!
Environment:
Request Method: POST
Request URL: http://localhost:8000/admin/login/?next=/admin/
Django Version: 2.0.5
Python Version: 3.6.5
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'picker_main']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\exception.py" in inner
35. response = get_response(request)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py" in _get_response
128. response = self.process_exception_by_middleware(e, request)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py" in _get_response
126. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\decorators\cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\admin\sites.py" in login
398. return LoginView.as_view(**defaults)(request)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\generic\base.py" in view
69. return self.dispatch(request, *args, **kwargs)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\decorators.py" in _wrapper
62. return bound_func(*args, **kwargs)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\decorators\debug.py" in sensitive_post_parameters_wrapper
76. return view(request, *args, **kwargs)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\decorators.py" in bound_func
58. return func.__get__(self, type(self))(*args2, **kwargs2)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\decorators.py" in _wrapper
62. return bound_func(*args, **kwargs)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\decorators.py" in _wrapped_view
142. response = view_func(request, *args, **kwargs)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\decorators.py" in bound_func
58. return func.__get__(self, type(self))(*args2, **kwargs2)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\decorators.py" in _wrapper
62. return bound_func(*args, **kwargs)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\decorators\cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\decorators.py" in bound_func
58. return func.__get__(self, type(self))(*args2, **kwargs2)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\auth\views.py" in dispatch
66. return super().dispatch(request, *args, **kwargs)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\generic\base.py" in dispatch
89. return handler(request, *args, **kwargs)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\views\generic\edit.py" in post
141. if form.is_valid():
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\forms\forms.py" in is_valid
179. return self.is_bound and not self.errors
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\forms\forms.py" in errors
174. self.full_clean()
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\forms\forms.py" in full_clean
377. self._clean_form()
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\forms\forms.py" in _clean_form
404. cleaned_data = self.clean()
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\auth\forms.py" in clean
195. self.user_cache = authenticate(self.request, username=username, password=password)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\auth\__init__.py" in authenticate
70. user = _authenticate_with_backend(backend, backend_path, request, credentials)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\auth\__init__.py" in _authenticate_with_backend
116. return backend.authenticate(*args, **credentials)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\auth\backends.py" in authenticate
16. user = UserModel._default_manager.get_by_natural_key(username)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\contrib\auth\base_user.py" in get_by_natural_key
44. return self.get(**{self.model.USERNAME_FIELD: username})
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\manager.py" in manager_method
82. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\query.py" in get
397. num = len(clone)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\query.py" in __len__
254. self._fetch_all()
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\query.py" in _fetch_all
1179. self._result_cache = list(self._iterable_class(self))
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\query.py" in __iter__
62. for row in compiler.results_iter(results):
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\sql\compiler.py" in apply_converters
1005. for row in map(list, rows):
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\sql\compiler.py" in cursor_iter
1460. for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\models\sql\compiler.py" in <lambda>
1460. for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\django\db\utils.py" in inner
96. return func(*args, **kwargs)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\mysql\connector\cursor_cext.py" in fetchmany
510. rows.extend(self._cnx.get_rows(size))
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\mysql\connector\connection_cext.py" in get_rows
275. row[i])
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\mysql\connector\conversion.py" in to_python
205. return self._cache_field_types[vtype[1]](value, vtype)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\mysql\connector\django\base.py" in _DATETIME_to_python
119. dt = MySQLConverter._DATETIME_to_python(self, value)
File "C:\Users\XSHA\AppData\Local\Programs\Python\Python36\lib\site-packages\mysql\connector\conversion.py" in _DATETIME_to_python
506. (date_, time_) = value.split(b' ')
Exception Type: AttributeError at /admin/login/
Exception Value: 'datetime.datetime' object has no attribute 'split'