We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Modify page routing to allow for any database name
## Current behavior

- Many of our pages have URLs that begin with the database name.
- We also have routes that begin with things like `administration` and `auth`.
- Those routing rules produce an ambiguous routing grammar making it impossible to use Mathesar with a database named "administration" (for example).

## Desired behavior

We should change `/<db_name>/` to `/db/<db_name>`



--- 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/urls.py`
Content:
```
1 from django.contrib.auth.views import LoginView
2 from django.urls import include, path, re_path
3 from rest_framework_nested import routers
4 
5 from mathesar import views
6 from mathesar.api.db import viewsets as db_viewsets
7 from mathesar.api.ui import viewsets as ui_viewsets
8 from mathesar.users.password_reset import MathesarPasswordResetConfirmView
9 
10 db_router = routers.DefaultRouter()
11 db_router.register(r'tables', db_viewsets.TableViewSet, basename='table')
12 db_router.register(r'queries', db_viewsets.QueryViewSet, basename='query')
13 db_router.register(r'links', db_viewsets.LinkViewSet, basename='links')
14 db_router.register(r'schemas', db_viewsets.SchemaViewSet, basename='schema')
15 db_router.register(r'databases', db_viewsets.DatabaseViewSet, basename='database')
16 db_router.register(r'data_files', db_viewsets.DataFileViewSet, basename='data-file')
17 
18 db_table_router = routers.NestedSimpleRouter(db_router, r'tables', lookup='table')
19 db_table_router.register(r'records', db_viewsets.RecordViewSet, basename='table-record')
20 db_table_router.register(r'settings', db_viewsets.TableSettingsViewSet, basename='table-setting')
21 db_table_router.register(r'columns', db_viewsets.ColumnViewSet, basename='table-column')
22 db_table_router.register(r'constraints', db_viewsets.ConstraintViewSet, basename='table-constraint')
23 
24 ui_router = routers.DefaultRouter()
25 ui_router.register(r'version', ui_viewsets.VersionViewSet, basename='version')
26 ui_router.register(r'databases', ui_viewsets.DatabaseViewSet, basename='database')
27 ui_router.register(r'users', ui_viewsets.UserViewSet, basename='user')
28 ui_router.register(r'database_roles', ui_viewsets.DatabaseRoleViewSet, basename='database_role')
29 ui_router.register(r'schema_roles', ui_viewsets.SchemaRoleViewSet, basename='schema_role')
30 
31 ui_table_router = routers.NestedSimpleRouter(db_router, r'tables', lookup='table')
32 ui_table_router.register(r'records', ui_viewsets.RecordViewSet, basename='table-record')
33 
34 urlpatterns = [
35     path('api/db/v0/', include(db_router.urls)),
36     path('api/db/v0/', include(db_table_router.urls)),
37     path('api/ui/v0/', include(ui_router.urls)),
38     path('api/ui/v0/', include(ui_table_router.urls)),
39     path('api/ui/v0/reflect/', views.reflect_all, name='reflect_all'),
40     path('auth/password_reset_confirm', MathesarPasswordResetConfirmView.as_view(), name='password_reset_confirm'),
41     path('auth/login/', LoginView.as_view(redirect_authenticated_user=True), name='login'),
42     path('auth/', include('django.contrib.auth.urls')),
43     path('', views.home, name='home'),
44     path('profile/', views.profile, name='profile'),
45     path('administration/', views.admin_home, name='admin_home'),
46     path('administration/users/', views.admin_home, name='admin_users_home'),
47     path('administration/users/<user_id>/', views.admin_home, name='admin_users_edit'),
48     path('administration/update/', views.admin_home, name='admin_update'),
49     path('<db_name>/', views.schemas, name='schemas'),
50     re_path(
51         r'^(?P<db_name>\w+)/(?P<schema_id>\w+)/',
52         views.schema_home,
53         name='schema_home'
54     ),
55 ]
56
```
--- 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/mathesar/urls.py b/mathesar/urls.py
--- a/mathesar/urls.py
+++ b/mathesar/urls.py
@@ -46,9 +46,10 @@
     path('administration/users/', views.admin_home, name='admin_users_home'),
     path('administration/users/<user_id>/', views.admin_home, name='admin_users_edit'),
     path('administration/update/', views.admin_home, name='admin_update'),
-    path('<db_name>/', views.schemas, name='schemas'),
+    path('db/', views.home, name='db_home'),
+    path('db/<db_name>/', views.schemas, name='schemas'),
     re_path(
-        r'^(?P<db_name>\w+)/(?P<schema_id>\w+)/',
+        r'^db/(?P<db_name>\w+)/(?P<schema_id>\w+)/',
         views.schema_home,
         name='schema_home'
     ),

{"golden_diff": "diff --git a/mathesar/urls.py b/mathesar/urls.py\n--- a/mathesar/urls.py\n+++ b/mathesar/urls.py\n@@ -46,9 +46,10 @@\n     path('administration/users/', views.admin_home, name='admin_users_home'),\n     path('administration/users/<user_id>/', views.admin_home, name='admin_users_edit'),\n     path('administration/update/', views.admin_home, name='admin_update'),\n-    path('<db_name>/', views.schemas, name='schemas'),\n+    path('db/', views.home, name='db_home'),\n+    path('db/<db_name>/', views.schemas, name='schemas'),\n     re_path(\n-        r'^(?P<db_name>\\w+)/(?P<schema_id>\\w+)/',\n+        r'^db/(?P<db_name>\\w+)/(?P<schema_id>\\w+)/',\n         views.schema_home,\n         name='schema_home'\n     ),\n", "issue": "Modify page routing to allow for any database name\n## Current behavior\r\n\r\n- Many of our pages have URLs that begin with the database name.\r\n- We also have routes that begin with things like `administration` and `auth`.\r\n- Those routing rules produce an ambiguous routing grammar making it impossible to use Mathesar with a database named \"administration\" (for example).\r\n\r\n## Desired behavior\r\n\r\nWe should change `/<db_name>/` to `/db/<db_name>`\r\n\r\n\n", "before_files": [{"content": "from django.contrib.auth.views import LoginView\nfrom django.urls import include, path, re_path\nfrom rest_framework_nested import routers\n\nfrom mathesar import views\nfrom mathesar.api.db import viewsets as db_viewsets\nfrom mathesar.api.ui import viewsets as ui_viewsets\nfrom mathesar.users.password_reset import MathesarPasswordResetConfirmView\n\ndb_router = routers.DefaultRouter()\ndb_router.register(r'tables', db_viewsets.TableViewSet, basename='table')\ndb_router.register(r'queries', db_viewsets.QueryViewSet, basename='query')\ndb_router.register(r'links', db_viewsets.LinkViewSet, basename='links')\ndb_router.register(r'schemas', db_viewsets.SchemaViewSet, basename='schema')\ndb_router.register(r'databases', db_viewsets.DatabaseViewSet, basename='database')\ndb_router.register(r'data_files', db_viewsets.DataFileViewSet, basename='data-file')\n\ndb_table_router = routers.NestedSimpleRouter(db_router, r'tables', lookup='table')\ndb_table_router.register(r'records', db_viewsets.RecordViewSet, basename='table-record')\ndb_table_router.register(r'settings', db_viewsets.TableSettingsViewSet, basename='table-setting')\ndb_table_router.register(r'columns', db_viewsets.ColumnViewSet, basename='table-column')\ndb_table_router.register(r'constraints', db_viewsets.ConstraintViewSet, basename='table-constraint')\n\nui_router = routers.DefaultRouter()\nui_router.register(r'version', ui_viewsets.VersionViewSet, basename='version')\nui_router.register(r'databases', ui_viewsets.DatabaseViewSet, basename='database')\nui_router.register(r'users', ui_viewsets.UserViewSet, basename='user')\nui_router.register(r'database_roles', ui_viewsets.DatabaseRoleViewSet, basename='database_role')\nui_router.register(r'schema_roles', ui_viewsets.SchemaRoleViewSet, basename='schema_role')\n\nui_table_router = routers.NestedSimpleRouter(db_router, r'tables', lookup='table')\nui_table_router.register(r'records', ui_viewsets.RecordViewSet, basename='table-record')\n\nurlpatterns = [\n    path('api/db/v0/', include(db_router.urls)),\n    path('api/db/v0/', include(db_table_router.urls)),\n    path('api/ui/v0/', include(ui_router.urls)),\n    path('api/ui/v0/', include(ui_table_router.urls)),\n    path('api/ui/v0/reflect/', views.reflect_all, name='reflect_all'),\n    path('auth/password_reset_confirm', MathesarPasswordResetConfirmView.as_view(), name='password_reset_confirm'),\n    path('auth/login/', LoginView.as_view(redirect_authenticated_user=True), name='login'),\n    path('auth/', include('django.contrib.auth.urls')),\n    path('', views.home, name='home'),\n    path('profile/', views.profile, name='profile'),\n    path('administration/', views.admin_home, name='admin_home'),\n    path('administration/users/', views.admin_home, name='admin_users_home'),\n    path('administration/users/<user_id>/', views.admin_home, name='admin_users_edit'),\n    path('administration/update/', views.admin_home, name='admin_update'),\n    path('<db_name>/', views.schemas, name='schemas'),\n    re_path(\n        r'^(?P<db_name>\\w+)/(?P<schema_id>\\w+)/',\n        views.schema_home,\n        name='schema_home'\n    ),\n]\n", "path": "mathesar/urls.py"}], "after_files": [{"content": "from django.contrib.auth.views import LoginView\nfrom django.urls import include, path, re_path\nfrom rest_framework_nested import routers\n\nfrom mathesar import views\nfrom mathesar.api.db import viewsets as db_viewsets\nfrom mathesar.api.ui import viewsets as ui_viewsets\nfrom mathesar.users.password_reset import MathesarPasswordResetConfirmView\n\ndb_router = routers.DefaultRouter()\ndb_router.register(r'tables', db_viewsets.TableViewSet, basename='table')\ndb_router.register(r'queries', db_viewsets.QueryViewSet, basename='query')\ndb_router.register(r'links', db_viewsets.LinkViewSet, basename='links')\ndb_router.register(r'schemas', db_viewsets.SchemaViewSet, basename='schema')\ndb_router.register(r'databases', db_viewsets.DatabaseViewSet, basename='database')\ndb_router.register(r'data_files', db_viewsets.DataFileViewSet, basename='data-file')\n\ndb_table_router = routers.NestedSimpleRouter(db_router, r'tables', lookup='table')\ndb_table_router.register(r'records', db_viewsets.RecordViewSet, basename='table-record')\ndb_table_router.register(r'settings', db_viewsets.TableSettingsViewSet, basename='table-setting')\ndb_table_router.register(r'columns', db_viewsets.ColumnViewSet, basename='table-column')\ndb_table_router.register(r'constraints', db_viewsets.ConstraintViewSet, basename='table-constraint')\n\nui_router = routers.DefaultRouter()\nui_router.register(r'version', ui_viewsets.VersionViewSet, basename='version')\nui_router.register(r'databases', ui_viewsets.DatabaseViewSet, basename='database')\nui_router.register(r'users', ui_viewsets.UserViewSet, basename='user')\nui_router.register(r'database_roles', ui_viewsets.DatabaseRoleViewSet, basename='database_role')\nui_router.register(r'schema_roles', ui_viewsets.SchemaRoleViewSet, basename='schema_role')\n\nui_table_router = routers.NestedSimpleRouter(db_router, r'tables', lookup='table')\nui_table_router.register(r'records', ui_viewsets.RecordViewSet, basename='table-record')\n\nurlpatterns = [\n    path('api/db/v0/', include(db_router.urls)),\n    path('api/db/v0/', include(db_table_router.urls)),\n    path('api/ui/v0/', include(ui_router.urls)),\n    path('api/ui/v0/', include(ui_table_router.urls)),\n    path('api/ui/v0/reflect/', views.reflect_all, name='reflect_all'),\n    path('auth/password_reset_confirm', MathesarPasswordResetConfirmView.as_view(), name='password_reset_confirm'),\n    path('auth/login/', LoginView.as_view(redirect_authenticated_user=True), name='login'),\n    path('auth/', include('django.contrib.auth.urls')),\n    path('', views.home, name='home'),\n    path('profile/', views.profile, name='profile'),\n    path('administration/', views.admin_home, name='admin_home'),\n    path('administration/users/', views.admin_home, name='admin_users_home'),\n    path('administration/users/<user_id>/', views.admin_home, name='admin_users_edit'),\n    path('administration/update/', views.admin_home, name='admin_update'),\n    path('db/', views.home, name='db_home'),\n    path('db/<db_name>/', views.schemas, name='schemas'),\n    re_path(\n        r'^db/(?P<db_name>\\w+)/(?P<schema_id>\\w+)/',\n        views.schema_home,\n        name='schema_home'\n    ),\n]\n", "path": "mathesar/urls.py"}]}