Closed maofalt closed 7 months ago
I'm getting a 500 error as well but this time it is the bloody manage_tournament_tournament
thing again
tournament | psycopg2.errors.UndefinedTable: relation "manage_tournament_tournament" does not exist
tournament | LINE 1: SELECT (1) AS "a" FROM "manage_tournament_tournament" LIMIT ...
I have no idea how django works so it is difficult to fix it on my side. It seems like some problem with migrations. I deleted my repo and ran make fclean
so it shouldn't be a problem with my local repo.
redudnant migration! Don't make migration for the time being unless it is for initialization! fixed
When accesssing tournament page and request the create-and-lsit APi get it crashes in the backend (even though we get the correct result). This happpened in WSL2, to check if it happens too in a Ubuntu envrionment. Log from client:
Log below
Internal Server Error: /api/tournament/create-and-list/ tournament | Traceback (most recent call last): tournament | File "/usr/local/lib/python3.10/site-packages/django/contrib/sessions/backends/base.py", line 233, in _get_session tournament | return self._session_cache tournament | AttributeError: 'SessionStore' object has no attribute '_session_cache' tournament | tournament | During handling of the above exception, another exception occurred: tournament | tournament | Traceback (most recent call last): tournament | File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute tournament | return self.cursor.execute(sql, params) tournament | psycopg2.errors.UndefinedTable: relation "django_session" does not exist tournament | LINE 1: ...ession_data", "django_session"."expire_date" FROM "django_se... tournament | ^ tournament | tournament | tournament | The above exception was the direct cause of the following exception: tournament | tournament | Traceback (most recent call last): tournament | File "/usr/local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner tournament | response = get_response(request) tournament | File "/usr/local/lib/python3.10/site-packages/django/core/handlers/base.py", line 179, in _get_response tournament | response = wrapped_callback(request, *callback_args, callback_kwargs) tournament | File "/usr/local/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view tournament | return view_func(*args, *kwargs) tournament | File "/usr/local/lib/python3.10/site-packages/django/views/generic/base.py", line 70, in view tournament | return self.dispatch(request, args, kwargs) tournament | File "/usr/local/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch tournament | response = self.handle_exception(exc) tournament | File "/usr/local/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception tournament | self.raise_uncaught_exception(exc) tournament | File "/usr/local/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception tournament | raise exc tournament | File "/usr/local/lib/python3.10/site-packages/rest_framework/views.py", line 497, in dispatch tournament | self.initial(request, *args, *kwargs) tournament | File "/usr/local/lib/python3.10/site-packages/rest_framework/views.py", line 414, in initial tournament | self.perform_authentication(request) tournament | File "/usr/local/lib/python3.10/site-packages/rest_framework/views.py", line 324, in perform_authentication tournament | request.user tournament | File "/usr/local/lib/python3.10/site-packages/rest_framework/request.py", line 227, in user tournament | self._authenticate() tournament | File "/usr/local/lib/python3.10/site-packages/rest_framework/request.py", line 380, in _authenticate tournament | user_auth_tuple = authenticator.authenticate(self) tournament | File "/usr/local/lib/python3.10/site-packages/rest_framework/authentication.py", line 127, in authenticate tournament | if not user or not user.is_active: tournament | File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 240, in inner tournament | self._setup() tournament | File "/usr/local/lib/python3.10/site-packages/django/utils/functional.py", line 376, in _setup tournament | self._wrapped = self._setupfunc() tournament | File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/middleware.py", line 23, in
tournament | request.user = SimpleLazyObject(lambda: get_user(request))
tournament | File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/middleware.py", line 11, in get_user
tournament | request._cached_user = auth.get_user(request)
tournament | File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/init.py", line 174, in get_user
tournament | user_id = _get_user_session_key(request)
tournament | File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/init.py", line 58, in _get_user_session_key
tournament | return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])
tournament | File "/usr/local/lib/python3.10/site-packages/django/contrib/sessions/backends/base.py", line 65, in getitem
tournament | return self._session[key]
tournament | File "/usr/local/lib/python3.10/site-packages/django/contrib/sessions/backends/base.py", line 238, in _get_session
tournament | self._session_cache = self.load()
tournament | File "/usr/local/lib/python3.10/site-packages/django/contrib/sessions/backends/db.py", line 43, in load
tournament | s = self._get_session_from_db()
tournament | File "/usr/local/lib/python3.10/site-packages/django/contrib/sessions/backends/db.py", line 32, in _get_session_from_db
tournament | return self.model.objects.get(
tournament | File "/usr/local/lib/python3.10/site-packages/django/db/models/manager.py", line 85, in manager_method
tournament | return getattr(self.get_queryset(), name)( args, **kwargs)
tournament | File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 425, in get
tournament | num = len(clone)
tournament | File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 269, in len
tournament | self._fetch_all()
tournament | File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 1308, in _fetch_all
tournament | self._result_cache = list(self._iterable_class(self))
tournament | File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 53, in iter
tournament | results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
tournament | File "/usr/local/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1156, in execute_sql
tournament | cursor.execute(sql, params)
tournament | File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 98, in execute
tournament | return super().execute(sql, params)
tournament | File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 66, in execute
tournament | return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
tournament | File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
tournament | return executor(sql, params, many, context)
tournament | File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 79, in _execute
tournament | with self.db.wrap_database_errors:
tournament | File "/usr/local/lib/python3.10/site-packages/django/db/utils.py", line 90, in exit
tournament | raise dj_exc_value.with_traceback(traceback) from exc_value
tournament | File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
tournament | return self.cursor.execute(sql, params)
tournament | django.db.utils.ProgrammingError: relation "django_session" does not exist
tournament | LINE 1: ...ession_data", "django_session"."expire_date" FROM "django_se...