We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
fix(django): Disable admin on prod
Reported here: https://forum.sentry.io/t/sentry-django-admin-portal/12787?u=byk


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/sentry/conf/urls.py`
Content:
```
1 from __future__ import annotations
2 
3 from django.conf import settings
4 from django.urls import URLPattern, URLResolver, re_path
5 
6 from sentry.web.frontend import csrf_failure
7 from sentry.web.frontend.error_404 import Error404View
8 from sentry.web.frontend.error_500 import Error500View
9 from sentry.web.urls import urlpatterns as web_urlpatterns
10 
11 handler404 = Error404View.as_view()
12 handler500 = Error500View.as_view()
13 
14 urlpatterns: list[URLResolver | URLPattern] = [
15     re_path(
16         r"^500/",
17         handler500,
18         name="error-500",
19     ),
20     re_path(
21         r"^404/",
22         handler404,
23         name="error-404",
24     ),
25     re_path(
26         r"^403-csrf-failure/",
27         csrf_failure.view,
28         name="error-403-csrf-failure",
29     ),
30 ]
31 
32 if "django.contrib.admin" in settings.INSTALLED_APPS:
33     from sentry import django_admin
34 
35     urlpatterns += django_admin.urlpatterns
36 
37 urlpatterns += web_urlpatterns
38
```
--- 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/src/sentry/conf/urls.py b/src/sentry/conf/urls.py
--- a/src/sentry/conf/urls.py
+++ b/src/sentry/conf/urls.py
@@ -29,7 +29,7 @@
     ),
 ]
 
-if "django.contrib.admin" in settings.INSTALLED_APPS:
+if "django.contrib.admin" in settings.INSTALLED_APPS and settings.ADMIN_ENABLED:
     from sentry import django_admin
 
     urlpatterns += django_admin.urlpatterns

{"golden_diff": "diff --git a/src/sentry/conf/urls.py b/src/sentry/conf/urls.py\n--- a/src/sentry/conf/urls.py\n+++ b/src/sentry/conf/urls.py\n@@ -29,7 +29,7 @@\n     ),\n ]\n \n-if \"django.contrib.admin\" in settings.INSTALLED_APPS:\n+if \"django.contrib.admin\" in settings.INSTALLED_APPS and settings.ADMIN_ENABLED:\n     from sentry import django_admin\n \n     urlpatterns += django_admin.urlpatterns\n", "issue": "fix(django): Disable admin on prod\nReported here: https://forum.sentry.io/t/sentry-django-admin-portal/12787?u=byk\n\n", "before_files": [{"content": "from __future__ import annotations\n\nfrom django.conf import settings\nfrom django.urls import URLPattern, URLResolver, re_path\n\nfrom sentry.web.frontend import csrf_failure\nfrom sentry.web.frontend.error_404 import Error404View\nfrom sentry.web.frontend.error_500 import Error500View\nfrom sentry.web.urls import urlpatterns as web_urlpatterns\n\nhandler404 = Error404View.as_view()\nhandler500 = Error500View.as_view()\n\nurlpatterns: list[URLResolver | URLPattern] = [\n    re_path(\n        r\"^500/\",\n        handler500,\n        name=\"error-500\",\n    ),\n    re_path(\n        r\"^404/\",\n        handler404,\n        name=\"error-404\",\n    ),\n    re_path(\n        r\"^403-csrf-failure/\",\n        csrf_failure.view,\n        name=\"error-403-csrf-failure\",\n    ),\n]\n\nif \"django.contrib.admin\" in settings.INSTALLED_APPS:\n    from sentry import django_admin\n\n    urlpatterns += django_admin.urlpatterns\n\nurlpatterns += web_urlpatterns\n", "path": "src/sentry/conf/urls.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom django.conf import settings\nfrom django.urls import URLPattern, URLResolver, re_path\n\nfrom sentry.web.frontend import csrf_failure\nfrom sentry.web.frontend.error_404 import Error404View\nfrom sentry.web.frontend.error_500 import Error500View\nfrom sentry.web.urls import urlpatterns as web_urlpatterns\n\nhandler404 = Error404View.as_view()\nhandler500 = Error500View.as_view()\n\nurlpatterns: list[URLResolver | URLPattern] = [\n    re_path(\n        r\"^500/\",\n        handler500,\n        name=\"error-500\",\n    ),\n    re_path(\n        r\"^404/\",\n        handler404,\n        name=\"error-404\",\n    ),\n    re_path(\n        r\"^403-csrf-failure/\",\n        csrf_failure.view,\n        name=\"error-403-csrf-failure\",\n    ),\n]\n\nif \"django.contrib.admin\" in settings.INSTALLED_APPS and settings.ADMIN_ENABLED:\n    from sentry import django_admin\n\n    urlpatterns += django_admin.urlpatterns\n\nurlpatterns += web_urlpatterns\n", "path": "src/sentry/conf/urls.py"}]}