ProgrammingError: relation does not exist due to search_path
ProgrammingError: relation does not exist due to search_path
$ python manage.py migrate
...
ProgrammingError: relation "public.app_model" does not exist
Why this happens
DB uses schemas and search_path doesn’t include the schema where tables were created.
Fix
Adjust DB user search_path or set OPTIONS in DATABASES to specify schema.
Wrong code
DATABASES['default']['OPTIONS'] = {}
Fixed code
DATABASES['default']['OPTIONS'] = {
'options': '-c search_path=public'
}