简体   繁体   中英

django project giving 500 internel server error

I have a Django project which was working fine till last night. And now I'm getting this error错误页面

and this is what I'm getting in my terminal终端

All I did was tried changing my virtualenv I deleted my last virtualenv because it was installing packages in my global environment and created a new one, reinstalled requirements.txt, and ran manage.py runserver . Now I'm getting this error. I have no idea what went wrong.

I'm using Windows10, Python3.6, and Django 3.0

This is the error after setting DEBUG=TRUE in settings.py

在此处输入图像描述

this is the error in my terminal, I guess something's wrong within python itself and not Django, if it helps

Django version 3.0, using settings 'configurations.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Internal Server Error: /
Traceback (most recent call last):
  File "D:\IWCN\exfi\env\lib\site-packages\django\contrib\sessions\backends\base.py", line 199, in _get_session
    return self._session_cache
AttributeError: 'SessionStore' object has no attribute '_session_cache'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\IWCN\exfi\env\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
    response = get_response(request)
  File "D:\IWCN\exfi\env\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "D:\IWCN\exfi\env\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "D:\IWCN\exfi\env\lib\site-packages\django\contrib\auth\decorators.py", line 20, in _wrapped_view
    if test_func(request.user):
  File "D:\IWCN\exfi\env\lib\site-packages\django\contrib\auth\decorators.py", line 44, in <lambda>
    lambda u: u.is_authenticated,
  File "D:\IWCN\exfi\env\lib\site-packages\django\utils\functional.py", line 224, in inner
    self._setup()
  File "D:\IWCN\exfi\env\lib\site-packages\django\utils\functional.py", line 360, in _setup
    self._wrapped = self._setupfunc()
  File "D:\IWCN\exfi\env\lib\site-packages\django\contrib\auth\middleware.py", line 24, in <lambda>
    request.user = SimpleLazyObject(lambda: get_user(request))
  File "D:\IWCN\exfi\env\lib\site-packages\django\contrib\auth\middleware.py", line 12, in get_user
    request._cached_user = auth.get_user(request)
  File "D:\IWCN\exfi\env\lib\site-packages\django\contrib\auth\__init__.py", line 173, in get_user
    user_id = _get_user_session_key(request)
  File "D:\IWCN\exfi\env\lib\site-packages\django\contrib\auth\__init__.py", line 58, in _get_user_session_key
    return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])
  File "D:\IWCN\exfi\env\lib\site-packages\django\contrib\sessions\backends\base.py", line 64, in __getitem__
    return self._session[key]
  File "D:\IWCN\exfi\env\lib\site-packages\django\contrib\sessions\backends\base.py", line 204, in _get_session
    self._session_cache = self.load()
  File "D:\IWCN\exfi\env\lib\site-packages\django\contrib\sessions\backends\db.py", line 44, in load
    return self.decode(s.session_data) if s else {}
  File "D:\IWCN\exfi\env\lib\site-packages\django\contrib\sessions\backends\base.py", line 110, in decode
    encoded_data = base64.b64decode(session_data.encode('ascii'))
  File "c:\python36\lib\base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
[24/Dec/2020 12:33:34] "GET / HTTP/1.1" 500 124286

If your are using something like base64 decoding you can refer here

or you can use the following code in your settings.py :

DEBUG_PROPAGATE_EXCEPTIONS = True

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM