MCPcopy
hub / github.com/reflex-dev/reflex / _setup_admin_dash

Method _setup_admin_dash

reflex/app.py:1070–1098  ·  view source on GitHub ↗

Setup the admin dash.

(self)

Source from the content-addressed store, hash-verified

1068 break
1069
1070 def _setup_admin_dash(self):
1071 """Setup the admin dash."""
1072 try:
1073 from starlette_admin.contrib.sqla.admin import Admin
1074 from starlette_admin.contrib.sqla.view import ModelView
1075
1076 from reflex.model import get_engine
1077 except ImportError:
1078 return
1079
1080 # Get the admin dash.
1081 if not self._api:
1082 return
1083
1084 admin_dash = self.admin_dash
1085
1086 if admin_dash and admin_dash.models:
1087 # Build the admin dashboard
1088 admin = admin_dash.admin or Admin(
1089 engine=get_engine(),
1090 title="Reflex Admin Dashboard",
1091 logo_url="https://reflex.dev/Reflex.svg",
1092 )
1093
1094 for model in admin_dash.models:
1095 view = admin_dash.view_overrides.get(model, ModelView)
1096 admin.add_view(view(model))
1097
1098 admin.mount_to(self._api)
1099
1100 def _get_frontend_packages(
1101 self,

Callers 1

__post_init__Method · 0.95

Calls 2

get_engineFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected