MensaToday/mensa-today

๐Ÿ› 500Internal Server Error with get_week_recommendation and get_recommendations

lgiesen opened this issue ยท 5 comments

get_recommendations:
body:

{
    "day": "2023.01.17",
    "entire_week": "True"
}

log:

data-integration-recommender-db-1      | 2023-01-16 16:35:11.638 UTC [229] ERROR:  relation "courses_usercourse" does not exist at character 140
data-integration-recommender-db-1      | 2023-01-16 16:35:11.638 UTC [229] STATEMENT:  SELECT "courses_usercourse"."id", "courses_usercourse"."user_id", "courses_usercourse"."course_id", "courses_usercourse"."crawl_date" FROM "courses_usercourse" WHERE "courses_usercourse"."user_id" = 2
data-integration-recommender-db-1      | 2023-01-16 16:35:11.684 UTC [229] ERROR:  relation "courses_usercourse" does not exist at character 140
data-integration-recommender-db-1      | 2023-01-16 16:35:11.684 UTC [229] STATEMENT:  SELECT "courses_usercourse"."id", "courses_usercourse"."user_id", "courses_usercourse"."course_id", "courses_usercourse"."crawl_date" FROM "courses_usercourse" WHERE "courses_usercourse"."user_id" = 2 LIMIT 21
data-integration-recommender-db-1      | 2023-01-16 16:35:11.686 UTC [229] ERROR:  relation "courses_usercourse" does not exist at character 140
data-integration-recommender-db-1      | 2023-01-16 16:35:11.686 UTC [229] STATEMENT:  SELECT "courses_usercourse"."id", "courses_usercourse"."user_id", "courses_usercourse"."course_id", "courses_usercourse"."crawl_date" FROM "courses_usercourse" WHERE "courses_usercourse"."user_id" = 2 LIMIT 21
data-integration-recommender-db-1      | 2023-01-16 16:35:11.687 UTC [229] ERROR:  relation "courses_usercourse" does not exist at character 140
data-integration-recommender-db-1      | 2023-01-16 16:35:11.687 UTC [229] STATEMENT:  SELECT "courses_usercourse"."id", "courses_usercourse"."user_id", "courses_usercourse"."course_id", "courses_usercourse"."crawl_date" FROM "courses_usercourse" WHERE "courses_usercourse"."user_id" = 2 LIMIT 21
data-integration-recommender-db-1      | 2023-01-16 16:35:11.689 UTC [229] ERROR:  relation "courses_usercourse" does not exist at character 140
data-integration-recommender-db-1      | 2023-01-16 16:35:11.689 UTC [229] STATEMENT:  SELECT "courses_usercourse"."id", "courses_usercourse"."user_id", "courses_usercourse"."course_id", "courses_usercourse"."crawl_date" FROM "courses_usercourse" WHERE "courses_usercourse"."user_id" = 2 LIMIT 21
data-integration-recommender-db-1      | 2023-01-16 16:35:11.690 UTC [229] ERROR:  relation "courses_usercourse" does not exist at character 140
data-integration-recommender-db-1      | 2023-01-16 16:35:11.690 UTC [229] STATEMENT:  SELECT "courses_usercourse"."id", "courses_usercourse"."user_id", "courses_usercourse"."course_id", "courses_usercourse"."crawl_date" FROM "courses_usercourse" WHERE "courses_usercourse"."user_id" = 2 LIMIT 21
data-integration-recommender-app-1     | Internal Server Error: /api/v1/mensa/get_recommendations
data-integration-recommender-app-1     | Traceback (most recent call last):
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
data-integration-recommender-app-1     |     return self.cursor.execute(sql, params)
data-integration-recommender-app-1     | psycopg2.errors.UndefinedTable: relation "courses_usercourse" does not exist
data-integration-recommender-app-1     | LINE 1: ...ourse_id", "courses_usercourse"."crawl_date" FROM "courses_u...
data-integration-recommender-app-1     |                                                              ^
data-integration-recommender-app-1     | 
data-integration-recommender-app-1     | 
data-integration-recommender-app-1     | The above exception was the direct cause of the following exception:
data-integration-recommender-app-1     | 
data-integration-recommender-app-1     | Traceback (most recent call last):
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
data-integration-recommender-app-1     |     response = get_response(request)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
data-integration-recommender-app-1     |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
data-integration-recommender-app-1     |     return view_func(*args, **kwargs)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 103, in view
data-integration-recommender-app-1     |     return self.dispatch(request, *args, **kwargs)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
data-integration-recommender-app-1     |     response = self.handle_exception(exc)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
data-integration-recommender-app-1     |     self.raise_uncaught_exception(exc)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
data-integration-recommender-app-1     |     raise exc
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
data-integration-recommender-app-1     |     response = handler(request, *args, **kwargs)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/decorators.py", line 50, in handler
data-integration-recommender-app-1     |     return func(*args, **kwargs)
data-integration-recommender-app-1     |   File "/app/mensa/views.py", line 393, in get_recommendations
data-integration-recommender-app-1     |     r = recommender.DishRecommender(request.user, day, entire_week)
data-integration-recommender-app-1     |   File "/app/mensa_recommend/source/recommendation/recommender.py", line 173, in __init__
data-integration-recommender-app-1     |     self._mensa_distances = self.__compute_mensa_distance_scores()
data-integration-recommender-app-1     |   File "/app/mensa_recommend/source/recommendation/recommender.py", line 477, in __compute_mensa_distance_scores
data-integration-recommender-app-1     |     distances = user_location.get_user_location(self._user,
data-integration-recommender-app-1     |   File "/app/mensa_recommend/source/computations/user_location.py", line 48, in get_user_location
data-integration-recommender-app-1     |     valid_reservations = get_relevant_reservations(user_courses, current_date)
data-integration-recommender-app-1     |   File "/app/mensa_recommend/source/computations/user_location.py", line 90, in get_relevant_reservations
data-integration-recommender-app-1     |     for user_course in user_courses:
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 394, in __iter__
data-integration-recommender-app-1     |     self._fetch_all()
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1866, in _fetch_all
data-integration-recommender-app-1     |     self._result_cache = list(self._iterable_class(self))
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 87, in __iter__
data-integration-recommender-app-1     |     results = compiler.execute_sql(
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1398, in execute_sql
data-integration-recommender-app-1     |     cursor.execute(sql, params)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 103, in execute
data-integration-recommender-app-1     |     return super().execute(sql, params)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute
data-integration-recommender-app-1     |     return self._execute_with_wrappers(
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
data-integration-recommender-app-1     |     return executor(sql, params, many, context)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
data-integration-recommender-app-1     |     return self.cursor.execute(sql, params)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 91, in __exit__
data-integration-recommender-app-1     |     raise dj_exc_value.with_traceback(traceback) from exc_value
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
data-integration-recommender-app-1     |     return self.cursor.execute(sql, params)
data-integration-recommender-app-1     | django.db.utils.ProgrammingError: relation "courses_usercourse" does not exist
data-integration-recommender-app-1     | LINE 1: ...ourse_id", "courses_usercourse"."crawl_date" FROM "courses_u...
data-integration-recommender-app-1     |                                                              ^
data-integration-recommender-app-1     | 
data-integration-recommender-app-1     | [16/Jan/2023 16:35:11] "GET /api/v1/mensa/get_recommendations HTTP/1.1" 500 161216

get_week_recommendation:
log:

data-integration-recommender-db-1      | 2023-01-16 16:36:34.037 UTC [233] STATEMENT:  SELECT "courses_usercourse"."id", "courses_usercourse"."user_id", "courses_usercourse"."course_id", "courses_usercourse"."crawl_date" FROM "courses_usercourse" WHERE "courses_usercourse"."user_id" = 2
data-integration-recommender-db-1      | 2023-01-16 16:36:34.093 UTC [233] ERROR:  relation "courses_usercourse" does not exist at character 140
data-integration-recommender-db-1      | 2023-01-16 16:36:34.093 UTC [233] STATEMENT:  SELECT "courses_usercourse"."id", "courses_usercourse"."user_id", "courses_usercourse"."course_id", "courses_usercourse"."crawl_date" FROM "courses_usercourse" WHERE "courses_usercourse"."user_id" = 2 LIMIT 21
data-integration-recommender-db-1      | 2023-01-16 16:36:34.095 UTC [233] ERROR:  relation "courses_usercourse" does not exist at character 140
data-integration-recommender-db-1      | 2023-01-16 16:36:34.095 UTC [233] STATEMENT:  SELECT "courses_usercourse"."id", "courses_usercourse"."user_id", "courses_usercourse"."course_id", "courses_usercourse"."crawl_date" FROM "courses_usercourse" WHERE "courses_usercourse"."user_id" = 2 LIMIT 21
data-integration-recommender-db-1      | 2023-01-16 16:36:34.097 UTC [233] ERROR:  relation "courses_usercourse" does not exist at character 140
data-integration-recommender-db-1      | 2023-01-16 16:36:34.097 UTC [233] STATEMENT:  SELECT "courses_usercourse"."id", "courses_usercourse"."user_id", "courses_usercourse"."course_id", "courses_usercourse"."crawl_date" FROM "courses_usercourse" WHERE "courses_usercourse"."user_id" = 2 LIMIT 21
data-integration-recommender-db-1      | 2023-01-16 16:36:34.100 UTC [233] ERROR:  relation "courses_usercourse" does not exist at character 140
data-integration-recommender-db-1      | 2023-01-16 16:36:34.100 UTC [233] STATEMENT:  SELECT "courses_usercourse"."id", "courses_usercourse"."user_id", "courses_usercourse"."course_id", "courses_usercourse"."crawl_date" FROM "courses_usercourse" WHERE "courses_usercourse"."user_id" = 2 LIMIT 21
data-integration-recommender-db-1      | 2023-01-16 16:36:34.102 UTC [233] ERROR:  relation "courses_usercourse" does not exist at character 140
data-integration-recommender-db-1      | 2023-01-16 16:36:34.102 UTC [233] STATEMENT:  SELECT "courses_usercourse"."id", "courses_usercourse"."user_id", "courses_usercourse"."course_id", "courses_usercourse"."crawl_date" FROM "courses_usercourse" WHERE "courses_usercourse"."user_id" = 2 LIMIT 21
data-integration-recommender-app-1     | Internal Server Error: /api/v1/mensa/get_week_recommendation
data-integration-recommender-app-1     | Traceback (most recent call last):
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
data-integration-recommender-app-1     |     return self.cursor.execute(sql, params)
data-integration-recommender-app-1     | psycopg2.errors.UndefinedTable: relation "courses_usercourse" does not exist
data-integration-recommender-app-1     | LINE 1: ...ourse_id", "courses_usercourse"."crawl_date" FROM "courses_u...
data-integration-recommender-app-1     |                                                              ^
data-integration-recommender-app-1     | 
data-integration-recommender-app-1     | 
data-integration-recommender-app-1     | The above exception was the direct cause of the following exception:
data-integration-recommender-app-1     | 
data-integration-recommender-app-1     | Traceback (most recent call last):
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
data-integration-recommender-app-1     |     response = get_response(request)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
data-integration-recommender-app-1     |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
data-integration-recommender-app-1     |     return view_func(*args, **kwargs)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 103, in view
data-integration-recommender-app-1     |     return self.dispatch(request, *args, **kwargs)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
data-integration-recommender-app-1     |     response = self.handle_exception(exc)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
data-integration-recommender-app-1     |     self.raise_uncaught_exception(exc)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
data-integration-recommender-app-1     |     raise exc
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
data-integration-recommender-app-1     |     response = handler(request, *args, **kwargs)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/decorators.py", line 50, in handler
data-integration-recommender-app-1     |     return func(*args, **kwargs)
data-integration-recommender-app-1     |   File "/app/mensa/views.py", line 264, in get_week_recommendation
data-integration-recommender-app-1     |     r = recommender.DishRecommender(request.user, datetime.today(), True)
data-integration-recommender-app-1     |   File "/app/mensa_recommend/source/recommendation/recommender.py", line 173, in __init__
data-integration-recommender-app-1     |     self._mensa_distances = self.__compute_mensa_distance_scores()
data-integration-recommender-app-1     |   File "/app/mensa_recommend/source/recommendation/recommender.py", line 477, in __compute_mensa_distance_scores
data-integration-recommender-app-1     |     distances = user_location.get_user_location(self._user,
data-integration-recommender-app-1     |   File "/app/mensa_recommend/source/computations/user_location.py", line 48, in get_user_location
data-integration-recommender-app-1     |     valid_reservations = get_relevant_reservations(user_courses, current_date)
data-integration-recommender-app-1     |   File "/app/mensa_recommend/source/computations/user_location.py", line 90, in get_relevant_reservations
data-integration-recommender-app-1     |     for user_course in user_courses:
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 394, in __iter__
data-integration-recommender-app-1     |     self._fetch_all()
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1866, in _fetch_all
data-integration-recommender-app-1     |     self._result_cache = list(self._iterable_class(self))
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 87, in __iter__
data-integration-recommender-app-1     |     results = compiler.execute_sql(
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1398, in execute_sql
data-integration-recommender-app-1     |     cursor.execute(sql, params)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 103, in execute
data-integration-recommender-app-1     |     return super().execute(sql, params)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute
data-integration-recommender-app-1     |     return self._execute_with_wrappers(
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
data-integration-recommender-app-1     |     return executor(sql, params, many, context)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
data-integration-recommender-app-1     |     return self.cursor.execute(sql, params)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 91, in __exit__
data-integration-recommender-app-1     |     raise dj_exc_value.with_traceback(traceback) from exc_value
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
data-integration-recommender-app-1     |     return self.cursor.execute(sql, params)
data-integration-recommender-app-1     | django.db.utils.ProgrammingError: relation "courses_usercourse" does not exist
data-integration-recommender-app-1     | LINE 1: ...ourse_id", "courses_usercourse"."crawl_date" FROM "courses_u...
data-integration-recommender-app-1     |                                                              ^
data-integration-recommender-app-1     | 
data-integration-recommender-app-1     | [16/Jan/2023 16:36:34] "GET /api/v1/mensa/get_week_recommendation HTTP/1.1" 500 160780

I just rebuilt the docker image and when I run the migrations (python manage.py migrate), I get the following error:

  Applying mensa.0003_alter_usersideselection_unique_together...Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "mensa_usersideselection" does not exist


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/manage.py", line 22, in <module>
    main()
  File "/app/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 402, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 96, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 349, in handle
    post_migrate_state = executor.migrate(
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/migration.py", line 130, in apply
    operation.database_forwards(
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/operations/models.py", line 564, in database_forwards
    alter_together(
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 542, in alter_unique_together
    self.execute(self._create_unique_sql(model, fields))
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 199, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 103, in execute
    return super().execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "mensa_usersideselection" does not exist

since we updated the whole data structure you should destroy the whole database and create it again. It should work after this.

I deleted the Docker container and rebuilt. Still had the same error with relation "mensa_usersideselection" does not exist. What did I do wrong?

data-integration-recommender-app-1     | Internal Server Error: /api/v1/mensa/get_recommendations
data-integration-recommender-app-1     | Traceback (most recent call last):
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
data-integration-recommender-app-1     |     return self.cursor.execute(sql, params)
data-integration-recommender-app-1     | psycopg2.errors.UndefinedTable: relation "courses_usercourse" does not exist
data-integration-recommender-app-1     | LINE 1: ...ourse_id", "courses_usercourse"."crawl_date" FROM "courses_u...
data-integration-recommender-app-1     |                                                              ^
data-integration-recommender-app-1     | 
data-integration-recommender-app-1     | 
data-integration-recommender-app-1     | The above exception was the direct cause of the following exception:
data-integration-recommender-app-1     | 
data-integration-recommender-app-1     | Traceback (most recent call last):
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
data-integration-recommender-app-1     |     response = get_response(request)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
data-integration-recommender-app-1     |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
data-integration-recommender-app-1     |     return view_func(*args, **kwargs)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 103, in view
data-integration-recommender-app-1     |     return self.dispatch(request, *args, **kwargs)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
data-integration-recommender-app-1     |     response = self.handle_exception(exc)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
data-integration-recommender-app-1     |     self.raise_uncaught_exception(exc)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
data-integration-recommender-app-1     |     raise exc
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
data-integration-recommender-app-1     |     response = handler(request, *args, **kwargs)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/rest_framework/decorators.py", line 50, in handler
data-integration-recommender-app-1     |     return func(*args, **kwargs)
data-integration-recommender-app-1     |   File "/app/mensa/views.py", line 393, in get_recommendations
data-integration-recommender-app-1     |     r = recommender.DishRecommender(request.user, day, entire_week)
data-integration-recommender-app-1     |   File "/app/mensa_recommend/source/recommendation/recommender.py", line 173, in __init__
data-integration-recommender-app-1     |     self._mensa_distances = self.__compute_mensa_distance_scores()
data-integration-recommender-app-1     |   File "/app/mensa_recommend/source/recommendation/recommender.py", line 477, in __compute_mensa_distance_scores
data-integration-recommender-app-1     |     distances = user_location.get_user_location(self._user,
data-integration-recommender-app-1     |   File "/app/mensa_recommend/source/computations/user_location.py", line 48, in get_user_location
data-integration-recommender-app-1     |     valid_reservations = get_relevant_reservations(user_courses, current_date)
data-integration-recommender-app-1     |   File "/app/mensa_recommend/source/computations/user_location.py", line 90, in get_relevant_reservations
data-integration-recommender-app-1     |     for user_course in user_courses:
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 394, in __iter__
data-integration-recommender-app-1     |     self._fetch_all()
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1866, in _fetch_all
data-integration-recommender-app-1     |     self._result_cache = list(self._iterable_class(self))
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 87, in __iter__
data-integration-recommender-app-1     |     results = compiler.execute_sql(
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1398, in execute_sql
data-integration-recommender-app-1     |     cursor.execute(sql, params)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 103, in execute
data-integration-recommender-app-1     |     return super().execute(sql, params)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute
data-integration-recommender-app-1     |     return self._execute_with_wrappers(
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
data-integration-recommender-app-1     |     return executor(sql, params, many, context)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
data-integration-recommender-app-1     |     return self.cursor.execute(sql, params)
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 91, in __exit__
data-integration-recommender-app-1     |     raise dj_exc_value.with_traceback(traceback) from exc_value
data-integration-recommender-app-1     |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
data-integration-recommender-app-1     |     return self.cursor.execute(sql, params)
data-integration-recommender-app-1     | django.db.utils.ProgrammingError: relation "courses_usercourse" does not exist
data-integration-recommender-app-1     | LINE 1: ...ourse_id", "courses_usercourse"."crawl_date" FROM "courses_u...
data-integration-recommender-app-1     |                                                              ^
data-integration-recommender-app-1     | 
data-integration-recommender-app-1     | [17/Jan/2023 07:20:12] "GET /api/v1/mensa/get_recommendations HTTP/1.1" 500 161216

Do I need to delete migrations? And I could log in without creating a new user, so obviously I didn't delete the database...

Yeah because creating a new docker container obviously does not delete all the data. You have to delete the postgres db volume. And after that start the app and apply the migrations. DO NOT delete any migrations

@MarcelRe9 - this worked for me (maybe adjust this powershell for cmd) (=delete volumes & image + rebuild):
docker-compose -f docker-compose.local.yaml down
docker rm -f $(docker ps -a -q)
docker volume rm $(docker volume ls -q)
docker-compose -f docker-compose.local.yaml up --build
docker exec -it data-integration-recommender-app-1 bash
python manage.py collect-all