We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Handle 404 pages throughout the app
## Description
* Client side routing: A non existent url results in a blank screen, or has obscure errors.
* Server side routing: A non existent url entered on the browser results in a 404, which returns a django 404 page.

## Expected behavior
* 404s should be clearly presented to the user in all valid cases.
* The 404 page should be consistent in appearance in both server side & client side routing. 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mathesar/views.py`
Content:
```
1 from django.conf import settings
2 from django.contrib.auth.decorators import login_required
3 from django.shortcuts import render, redirect, get_object_or_404
4 from rest_framework import status
5 from rest_framework.decorators import api_view
6 from rest_framework.response import Response
7 
8 from mathesar.api.db.permissions.database import DatabaseAccessPolicy
9 from mathesar.api.db.permissions.query import QueryAccessPolicy
10 from mathesar.api.db.permissions.schema import SchemaAccessPolicy
11 from mathesar.api.db.permissions.table import TableAccessPolicy
12 from mathesar.api.serializers.databases import DatabaseSerializer, TypeSerializer
13 from mathesar.api.serializers.schemas import SchemaSerializer
14 from mathesar.api.serializers.tables import TableSerializer
15 from mathesar.api.serializers.queries import QuerySerializer
16 from mathesar.api.ui.serializers.users import UserSerializer
17 from mathesar.database.types import UIType
18 from mathesar.models.base import Database, Schema, Table
19 from mathesar.models.query import UIQuery
20 from mathesar.state import reset_reflection
21 from mathesar import __version__
22 
23 
24 def get_schema_list(request, database):
25     qs = Schema.objects.filter(database=database)
26     permission_restricted_qs = SchemaAccessPolicy.scope_queryset(request, qs)
27     schema_serializer = SchemaSerializer(
28         permission_restricted_qs,
29         many=True,
30         context={'request': request}
31     )
32     return schema_serializer.data
33 
34 
35 def _get_permissible_db_queryset(request):
36     qs = Database.objects.all()
37     permission_restricted_qs = DatabaseAccessPolicy.scope_queryset(request, qs)
38     schema_qs = Schema.objects.all()
39     permitted_schemas = SchemaAccessPolicy.scope_queryset(request, schema_qs)
40     databases_from_permitted_schema = Database.objects.filter(schemas__in=permitted_schemas)
41     permission_restricted_qs = permission_restricted_qs | databases_from_permitted_schema
42     return permission_restricted_qs.distinct()
43 
44 
45 def get_database_list(request):
46     permission_restricted_db_qs = _get_permissible_db_queryset(request)
47     database_serializer = DatabaseSerializer(
48         permission_restricted_db_qs,
49         many=True,
50         context={'request': request}
51     )
52     return database_serializer.data
53 
54 
55 def get_table_list(request, schema):
56     if schema is None:
57         return []
58     qs = Table.objects.filter(schema=schema)
59     permission_restricted_qs = TableAccessPolicy.scope_queryset(request, qs)
60     table_serializer = TableSerializer(
61         permission_restricted_qs,
62         many=True,
63         context={'request': request}
64     )
65     return table_serializer.data
66 
67 
68 def get_queries_list(request, schema):
69     if schema is None:
70         return []
71     qs = UIQuery.objects.filter(base_table__schema=schema)
72     permission_restricted_qs = QueryAccessPolicy.scope_queryset(request, qs)
73 
74     query_serializer = QuerySerializer(
75         permission_restricted_qs,
76         many=True,
77         context={'request': request}
78     )
79     return query_serializer.data
80 
81 
82 def get_ui_type_list(request, database):
83     if database is None:
84         return []
85     type_serializer = TypeSerializer(
86         UIType,
87         many=True,
88         context={'request': request}
89     )
90     return type_serializer.data
91 
92 
93 def get_user_data(request):
94     user_serializer = UserSerializer(
95         request.user,
96         many=False,
97         context={'request': request}
98     )
99     return user_serializer.data
100 
101 
102 def get_common_data(request, database=None, schema=None):
103     return {
104         'current_db': database.name if database else None,
105         'current_schema': schema.id if schema else None,
106         'schemas': get_schema_list(request, database),
107         'databases': get_database_list(request),
108         'tables': get_table_list(request, schema),
109         'queries': get_queries_list(request, schema),
110         'abstract_types': get_ui_type_list(request, database),
111         'user': get_user_data(request),
112         'live_demo_mode': getattr(settings, 'MATHESAR_LIVE_DEMO', False),
113         'current_release_tag_name': __version__,
114     }
115 
116 
117 def get_current_database(request, db_name):
118     """Get database from passed name, with fall back behavior."""
119     permitted_databases = _get_permissible_db_queryset(request)
120     if db_name is not None:
121         current_database = get_object_or_404(permitted_databases, name=db_name)
122     else:
123         request_database_name = request.GET.get('database')
124         try:
125             if request_database_name is not None:
126                 # Try to get the database named specified in the request
127                 current_database = permitted_databases.get(name=request_database_name)
128             else:
129                 # Try to get the first database available
130                 current_database = permitted_databases.order_by('id').first()
131         except Database.DoesNotExist:
132             current_database = None
133     return current_database
134 
135 
136 def get_current_schema(request, schema_id, database):
137     # if there's a schema ID passed in, try to retrieve the schema, or return a 404 error.
138     if schema_id is not None:
139         permitted_schemas = SchemaAccessPolicy.scope_queryset(request, Schema.objects.all())
140         return get_object_or_404(permitted_schemas, id=schema_id)
141     else:
142         try:
143             # Try to get the first schema in the DB
144             return Schema.objects.filter(database=database).order_by('id').first()
145         except Schema.DoesNotExist:
146             return None
147 
148 
149 def render_schema(request, database, schema):
150     # if there's no schema available, redirect to the schemas page.
151     if not schema:
152         return redirect('schemas', db_name=database.name)
153     else:
154         # We are redirecting so that the correct URL is passed to the frontend.
155         return redirect('schema_home', db_name=database.name, schema_id=schema.id)
156 
157 
158 @login_required
159 @api_view(['POST'])
160 def reflect_all(_):
161     reset_reflection()
162     return Response(status=status.HTTP_200_OK)
163 
164 
165 @login_required
166 def home(request):
167     database = get_current_database(request, None)
168     if database is None:
169         return render(request, 'mathesar/index.html', {
170             'common_data': get_common_data(request, database)
171         })
172     return redirect('schemas', db_name=database.name)
173 
174 
175 @login_required
176 def profile(request):
177     return render(request, 'mathesar/index.html', {
178         'common_data': get_common_data(request)
179     })
180 
181 
182 @login_required
183 def admin_home(request, **kwargs):
184     return render(request, 'mathesar/index.html', {
185         'common_data': get_common_data(request)
186     })
187 
188 
189 @login_required
190 def schema_home(request, db_name, schema_id, **kwargs):
191     database = get_current_database(request, db_name)
192     schema = get_current_schema(request, schema_id, database)
193     return render(request, 'mathesar/index.html', {
194         'common_data': get_common_data(request, database, schema)
195     })
196 
197 
198 @login_required
199 def schemas(request, db_name):
200     database = get_current_database(request, db_name)
201     return render(request, 'mathesar/index.html', {
202         'common_data': get_common_data(request, database, None)
203     })
204
```

Path: `config/urls.py`
Content:
```
1 """config URL Configuration
2 
3 The `urlpatterns` list routes URLs to views. For more information please see:
4     https://docs.djangoproject.com/en/3.1/topics/http/urls/
5 Examples:
6 Function views
7     1. Add an import:  from my_app import views
8     2. Add a URL to urlpatterns:  path('', views.home, name='home')
9 Class-based views
10     1. Add an import:  from other_app.views import Home
11     2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
12 Including another URLconf
13     1. Import the include() function: from django.urls import include, path
14     2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
15 """
16 from django.contrib import admin
17 from django.urls import include, path
18 
19 from mathesar import urls as mathesar_urls
20 
21 
22 urlpatterns = [
23     path('admin/', admin.site.urls),
24     path('', include(mathesar_urls)),
25     path('api-docs/', include('rest_framework.urls')),
26 ]
27
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/config/urls.py b/config/urls.py
--- a/config/urls.py
+++ b/config/urls.py
@@ -24,3 +24,5 @@
     path('', include(mathesar_urls)),
     path('api-docs/', include('rest_framework.urls')),
 ]
+
+handler404 = 'mathesar.views.page_not_found_view'
diff --git a/mathesar/views.py b/mathesar/views.py
--- a/mathesar/views.py
+++ b/mathesar/views.py
@@ -201,3 +201,9 @@
     return render(request, 'mathesar/index.html', {
         'common_data': get_common_data(request, database, None)
     })
+
+
+def page_not_found_view(request, exception):
+    return render(request, 'mathesar/index.html', {
+        'common_data': get_common_data(request),
+    }, status=404)

{"golden_diff": "diff --git a/config/urls.py b/config/urls.py\n--- a/config/urls.py\n+++ b/config/urls.py\n@@ -24,3 +24,5 @@\n     path('', include(mathesar_urls)),\n     path('api-docs/', include('rest_framework.urls')),\n ]\n+\n+handler404 = 'mathesar.views.page_not_found_view'\ndiff --git a/mathesar/views.py b/mathesar/views.py\n--- a/mathesar/views.py\n+++ b/mathesar/views.py\n@@ -201,3 +201,9 @@\n     return render(request, 'mathesar/index.html', {\n         'common_data': get_common_data(request, database, None)\n     })\n+\n+\n+def page_not_found_view(request, exception):\n+    return render(request, 'mathesar/index.html', {\n+        'common_data': get_common_data(request),\n+    }, status=404)\n", "issue": "Handle 404 pages throughout the app\n## Description\r\n* Client side routing: A non existent url results in a blank screen, or has obscure errors.\r\n* Server side routing: A non existent url entered on the browser results in a 404, which returns a django 404 page.\r\n\r\n## Expected behavior\r\n* 404s should be clearly presented to the user in all valid cases.\r\n* The 404 page should be consistent in appearance in both server side & client side routing. \n", "before_files": [{"content": "from django.conf import settings\nfrom django.contrib.auth.decorators import login_required\nfrom django.shortcuts import render, redirect, get_object_or_404\nfrom rest_framework import status\nfrom rest_framework.decorators import api_view\nfrom rest_framework.response import Response\n\nfrom mathesar.api.db.permissions.database import DatabaseAccessPolicy\nfrom mathesar.api.db.permissions.query import QueryAccessPolicy\nfrom mathesar.api.db.permissions.schema import SchemaAccessPolicy\nfrom mathesar.api.db.permissions.table import TableAccessPolicy\nfrom mathesar.api.serializers.databases import DatabaseSerializer, TypeSerializer\nfrom mathesar.api.serializers.schemas import SchemaSerializer\nfrom mathesar.api.serializers.tables import TableSerializer\nfrom mathesar.api.serializers.queries import QuerySerializer\nfrom mathesar.api.ui.serializers.users import UserSerializer\nfrom mathesar.database.types import UIType\nfrom mathesar.models.base import Database, Schema, Table\nfrom mathesar.models.query import UIQuery\nfrom mathesar.state import reset_reflection\nfrom mathesar import __version__\n\n\ndef get_schema_list(request, database):\n    qs = Schema.objects.filter(database=database)\n    permission_restricted_qs = SchemaAccessPolicy.scope_queryset(request, qs)\n    schema_serializer = SchemaSerializer(\n        permission_restricted_qs,\n        many=True,\n        context={'request': request}\n    )\n    return schema_serializer.data\n\n\ndef _get_permissible_db_queryset(request):\n    qs = Database.objects.all()\n    permission_restricted_qs = DatabaseAccessPolicy.scope_queryset(request, qs)\n    schema_qs = Schema.objects.all()\n    permitted_schemas = SchemaAccessPolicy.scope_queryset(request, schema_qs)\n    databases_from_permitted_schema = Database.objects.filter(schemas__in=permitted_schemas)\n    permission_restricted_qs = permission_restricted_qs | databases_from_permitted_schema\n    return permission_restricted_qs.distinct()\n\n\ndef get_database_list(request):\n    permission_restricted_db_qs = _get_permissible_db_queryset(request)\n    database_serializer = DatabaseSerializer(\n        permission_restricted_db_qs,\n        many=True,\n        context={'request': request}\n    )\n    return database_serializer.data\n\n\ndef get_table_list(request, schema):\n    if schema is None:\n        return []\n    qs = Table.objects.filter(schema=schema)\n    permission_restricted_qs = TableAccessPolicy.scope_queryset(request, qs)\n    table_serializer = TableSerializer(\n        permission_restricted_qs,\n        many=True,\n        context={'request': request}\n    )\n    return table_serializer.data\n\n\ndef get_queries_list(request, schema):\n    if schema is None:\n        return []\n    qs = UIQuery.objects.filter(base_table__schema=schema)\n    permission_restricted_qs = QueryAccessPolicy.scope_queryset(request, qs)\n\n    query_serializer = QuerySerializer(\n        permission_restricted_qs,\n        many=True,\n        context={'request': request}\n    )\n    return query_serializer.data\n\n\ndef get_ui_type_list(request, database):\n    if database is None:\n        return []\n    type_serializer = TypeSerializer(\n        UIType,\n        many=True,\n        context={'request': request}\n    )\n    return type_serializer.data\n\n\ndef get_user_data(request):\n    user_serializer = UserSerializer(\n        request.user,\n        many=False,\n        context={'request': request}\n    )\n    return user_serializer.data\n\n\ndef get_common_data(request, database=None, schema=None):\n    return {\n        'current_db': database.name if database else None,\n        'current_schema': schema.id if schema else None,\n        'schemas': get_schema_list(request, database),\n        'databases': get_database_list(request),\n        'tables': get_table_list(request, schema),\n        'queries': get_queries_list(request, schema),\n        'abstract_types': get_ui_type_list(request, database),\n        'user': get_user_data(request),\n        'live_demo_mode': getattr(settings, 'MATHESAR_LIVE_DEMO', False),\n        'current_release_tag_name': __version__,\n    }\n\n\ndef get_current_database(request, db_name):\n    \"\"\"Get database from passed name, with fall back behavior.\"\"\"\n    permitted_databases = _get_permissible_db_queryset(request)\n    if db_name is not None:\n        current_database = get_object_or_404(permitted_databases, name=db_name)\n    else:\n        request_database_name = request.GET.get('database')\n        try:\n            if request_database_name is not None:\n                # Try to get the database named specified in the request\n                current_database = permitted_databases.get(name=request_database_name)\n            else:\n                # Try to get the first database available\n                current_database = permitted_databases.order_by('id').first()\n        except Database.DoesNotExist:\n            current_database = None\n    return current_database\n\n\ndef get_current_schema(request, schema_id, database):\n    # if there's a schema ID passed in, try to retrieve the schema, or return a 404 error.\n    if schema_id is not None:\n        permitted_schemas = SchemaAccessPolicy.scope_queryset(request, Schema.objects.all())\n        return get_object_or_404(permitted_schemas, id=schema_id)\n    else:\n        try:\n            # Try to get the first schema in the DB\n            return Schema.objects.filter(database=database).order_by('id').first()\n        except Schema.DoesNotExist:\n            return None\n\n\ndef render_schema(request, database, schema):\n    # if there's no schema available, redirect to the schemas page.\n    if not schema:\n        return redirect('schemas', db_name=database.name)\n    else:\n        # We are redirecting so that the correct URL is passed to the frontend.\n        return redirect('schema_home', db_name=database.name, schema_id=schema.id)\n\n\n@login_required\n@api_view(['POST'])\ndef reflect_all(_):\n    reset_reflection()\n    return Response(status=status.HTTP_200_OK)\n\n\n@login_required\ndef home(request):\n    database = get_current_database(request, None)\n    if database is None:\n        return render(request, 'mathesar/index.html', {\n            'common_data': get_common_data(request, database)\n        })\n    return redirect('schemas', db_name=database.name)\n\n\n@login_required\ndef profile(request):\n    return render(request, 'mathesar/index.html', {\n        'common_data': get_common_data(request)\n    })\n\n\n@login_required\ndef admin_home(request, **kwargs):\n    return render(request, 'mathesar/index.html', {\n        'common_data': get_common_data(request)\n    })\n\n\n@login_required\ndef schema_home(request, db_name, schema_id, **kwargs):\n    database = get_current_database(request, db_name)\n    schema = get_current_schema(request, schema_id, database)\n    return render(request, 'mathesar/index.html', {\n        'common_data': get_common_data(request, database, schema)\n    })\n\n\n@login_required\ndef schemas(request, db_name):\n    database = get_current_database(request, db_name)\n    return render(request, 'mathesar/index.html', {\n        'common_data': get_common_data(request, database, None)\n    })\n", "path": "mathesar/views.py"}, {"content": "\"\"\"config URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n    https://docs.djangoproject.com/en/3.1/topics/http/urls/\nExamples:\nFunction views\n    1. Add an import:  from my_app import views\n    2. Add a URL to urlpatterns:  path('', views.home, name='home')\nClass-based views\n    1. Add an import:  from other_app.views import Home\n    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')\nIncluding another URLconf\n    1. Import the include() function: from django.urls import include, path\n    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))\n\"\"\"\nfrom django.contrib import admin\nfrom django.urls import include, path\n\nfrom mathesar import urls as mathesar_urls\n\n\nurlpatterns = [\n    path('admin/', admin.site.urls),\n    path('', include(mathesar_urls)),\n    path('api-docs/', include('rest_framework.urls')),\n]\n", "path": "config/urls.py"}], "after_files": [{"content": "from django.conf import settings\nfrom django.contrib.auth.decorators import login_required\nfrom django.shortcuts import render, redirect, get_object_or_404\nfrom rest_framework import status\nfrom rest_framework.decorators import api_view\nfrom rest_framework.response import Response\n\nfrom mathesar.api.db.permissions.database import DatabaseAccessPolicy\nfrom mathesar.api.db.permissions.query import QueryAccessPolicy\nfrom mathesar.api.db.permissions.schema import SchemaAccessPolicy\nfrom mathesar.api.db.permissions.table import TableAccessPolicy\nfrom mathesar.api.serializers.databases import DatabaseSerializer, TypeSerializer\nfrom mathesar.api.serializers.schemas import SchemaSerializer\nfrom mathesar.api.serializers.tables import TableSerializer\nfrom mathesar.api.serializers.queries import QuerySerializer\nfrom mathesar.api.ui.serializers.users import UserSerializer\nfrom mathesar.database.types import UIType\nfrom mathesar.models.base import Database, Schema, Table\nfrom mathesar.models.query import UIQuery\nfrom mathesar.state import reset_reflection\nfrom mathesar import __version__\n\n\ndef get_schema_list(request, database):\n    qs = Schema.objects.filter(database=database)\n    permission_restricted_qs = SchemaAccessPolicy.scope_queryset(request, qs)\n    schema_serializer = SchemaSerializer(\n        permission_restricted_qs,\n        many=True,\n        context={'request': request}\n    )\n    return schema_serializer.data\n\n\ndef _get_permissible_db_queryset(request):\n    qs = Database.objects.all()\n    permission_restricted_qs = DatabaseAccessPolicy.scope_queryset(request, qs)\n    schema_qs = Schema.objects.all()\n    permitted_schemas = SchemaAccessPolicy.scope_queryset(request, schema_qs)\n    databases_from_permitted_schema = Database.objects.filter(schemas__in=permitted_schemas)\n    permission_restricted_qs = permission_restricted_qs | databases_from_permitted_schema\n    return permission_restricted_qs.distinct()\n\n\ndef get_database_list(request):\n    permission_restricted_db_qs = _get_permissible_db_queryset(request)\n    database_serializer = DatabaseSerializer(\n        permission_restricted_db_qs,\n        many=True,\n        context={'request': request}\n    )\n    return database_serializer.data\n\n\ndef get_table_list(request, schema):\n    if schema is None:\n        return []\n    qs = Table.objects.filter(schema=schema)\n    permission_restricted_qs = TableAccessPolicy.scope_queryset(request, qs)\n    table_serializer = TableSerializer(\n        permission_restricted_qs,\n        many=True,\n        context={'request': request}\n    )\n    return table_serializer.data\n\n\ndef get_queries_list(request, schema):\n    if schema is None:\n        return []\n    qs = UIQuery.objects.filter(base_table__schema=schema)\n    permission_restricted_qs = QueryAccessPolicy.scope_queryset(request, qs)\n\n    query_serializer = QuerySerializer(\n        permission_restricted_qs,\n        many=True,\n        context={'request': request}\n    )\n    return query_serializer.data\n\n\ndef get_ui_type_list(request, database):\n    if database is None:\n        return []\n    type_serializer = TypeSerializer(\n        UIType,\n        many=True,\n        context={'request': request}\n    )\n    return type_serializer.data\n\n\ndef get_user_data(request):\n    user_serializer = UserSerializer(\n        request.user,\n        many=False,\n        context={'request': request}\n    )\n    return user_serializer.data\n\n\ndef get_common_data(request, database=None, schema=None):\n    return {\n        'current_db': database.name if database else None,\n        'current_schema': schema.id if schema else None,\n        'schemas': get_schema_list(request, database),\n        'databases': get_database_list(request),\n        'tables': get_table_list(request, schema),\n        'queries': get_queries_list(request, schema),\n        'abstract_types': get_ui_type_list(request, database),\n        'user': get_user_data(request),\n        'live_demo_mode': getattr(settings, 'MATHESAR_LIVE_DEMO', False),\n        'current_release_tag_name': __version__,\n    }\n\n\ndef get_current_database(request, db_name):\n    \"\"\"Get database from passed name, with fall back behavior.\"\"\"\n    permitted_databases = _get_permissible_db_queryset(request)\n    if db_name is not None:\n        current_database = get_object_or_404(permitted_databases, name=db_name)\n    else:\n        request_database_name = request.GET.get('database')\n        try:\n            if request_database_name is not None:\n                # Try to get the database named specified in the request\n                current_database = permitted_databases.get(name=request_database_name)\n            else:\n                # Try to get the first database available\n                current_database = permitted_databases.order_by('id').first()\n        except Database.DoesNotExist:\n            current_database = None\n    return current_database\n\n\ndef get_current_schema(request, schema_id, database):\n    # if there's a schema ID passed in, try to retrieve the schema, or return a 404 error.\n    if schema_id is not None:\n        permitted_schemas = SchemaAccessPolicy.scope_queryset(request, Schema.objects.all())\n        return get_object_or_404(permitted_schemas, id=schema_id)\n    else:\n        try:\n            # Try to get the first schema in the DB\n            return Schema.objects.filter(database=database).order_by('id').first()\n        except Schema.DoesNotExist:\n            return None\n\n\ndef render_schema(request, database, schema):\n    # if there's no schema available, redirect to the schemas page.\n    if not schema:\n        return redirect('schemas', db_name=database.name)\n    else:\n        # We are redirecting so that the correct URL is passed to the frontend.\n        return redirect('schema_home', db_name=database.name, schema_id=schema.id)\n\n\n@login_required\n@api_view(['POST'])\ndef reflect_all(_):\n    reset_reflection()\n    return Response(status=status.HTTP_200_OK)\n\n\n@login_required\ndef home(request):\n    database = get_current_database(request, None)\n    if database is None:\n        return render(request, 'mathesar/index.html', {\n            'common_data': get_common_data(request, database)\n        })\n    return redirect('schemas', db_name=database.name)\n\n\n@login_required\ndef profile(request):\n    return render(request, 'mathesar/index.html', {\n        'common_data': get_common_data(request)\n    })\n\n\n@login_required\ndef admin_home(request, **kwargs):\n    return render(request, 'mathesar/index.html', {\n        'common_data': get_common_data(request)\n    })\n\n\n@login_required\ndef schema_home(request, db_name, schema_id, **kwargs):\n    database = get_current_database(request, db_name)\n    schema = get_current_schema(request, schema_id, database)\n    return render(request, 'mathesar/index.html', {\n        'common_data': get_common_data(request, database, schema)\n    })\n\n\n@login_required\ndef schemas(request, db_name):\n    database = get_current_database(request, db_name)\n    return render(request, 'mathesar/index.html', {\n        'common_data': get_common_data(request, database, None)\n    })\n\n\ndef page_not_found_view(request, exception):\n    return render(request, 'mathesar/index.html', {\n        'common_data': get_common_data(request),\n    }, status=404)\n", "path": "mathesar/views.py"}, {"content": "\"\"\"config URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n    https://docs.djangoproject.com/en/3.1/topics/http/urls/\nExamples:\nFunction views\n    1. Add an import:  from my_app import views\n    2. Add a URL to urlpatterns:  path('', views.home, name='home')\nClass-based views\n    1. Add an import:  from other_app.views import Home\n    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')\nIncluding another URLconf\n    1. Import the include() function: from django.urls import include, path\n    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))\n\"\"\"\nfrom django.contrib import admin\nfrom django.urls import include, path\n\nfrom mathesar import urls as mathesar_urls\n\n\nurlpatterns = [\n    path('admin/', admin.site.urls),\n    path('', include(mathesar_urls)),\n    path('api-docs/', include('rest_framework.urls')),\n]\n\nhandler404 = 'mathesar.views.page_not_found_view'\n", "path": "config/urls.py"}]}