This is the official documentation of the forestadmin-agent-django and forestadmin-agent-flask Python agents.
Add dependency forestadmin-agent-django to your Django app
pipinstallforestadmin-agent-django
You need to setup the forest Forest Admin agent, and CORS header settings.
# define the forest admin settingsFOREST_AUTH_SECRET = os.environ.get("FOREST_AUTH_SECRET")FOREST_ENV_SECRET = os.environ.get("FOREST_ENV_SECRET")# add it in the installed appsINSTALLED_APPS = [# ..."forestadmin.django_agent","corsheaders",# ...]# CORS settings# see https://github.com/adamchainz/django-cors-headers for more detailsMIDDLEWARE = [# ...# just before CommonMiddleware"corsheaders.middleware.CorsMiddleware","django.middleware.common.CommonMiddleware",# ...]CORS_ALLOWED_ORIGIN_REGEXES = [r".*\.forestadmin\.com.*",]CORS_ALLOW_CREDENTIALS =True
from django.urls import include, pathurlpatterns = [# ...path("", include("forestadmin.django_agent.urls")),# ...]
Running
FOREST_ENV_SECRET="<This is provided during the onboarding steps>" FOREST_AUTH_SECRET="<This is provided during the onboarding steps>"pythonmanage.pyrunserver
should be enough to be redirected to the "rate-install" page.