Python Developer Guide
Other documentationsDemoCommunityGitHub
  • Forest Admin
  • Getting started
    • How it works
    • Quick start
      • Flask
      • Django
    • Create your agent
    • Troubleshooting
    • Migrating legacy agents
      • Pre-requisites
      • Recommendations
      • Migration steps
      • Code transformations
        • API Charts
        • Live Queries
        • Smart Charts
        • Route overrides
        • Smart Actions
        • Smart Fields
        • Smart Relationships
        • Smart Segments
  • Data Sources
    • Getting Started
      • Collection selection
      • Naming conflicts
      • Query interface and Native Queries
        • Fields and projections
        • Filters
        • Aggregations
    • Provided data sources
      • SQLAlchemy
      • Django
        • Polymorphic relationships
    • Write your own
      • Translation strategy
        • Structure declaration
        • Capabilities declaration
        • Read implementation
        • Write implementation
        • Intra-data source Relationships
      • Contribute
  • Agent customization
    • Getting Started
    • Actions
      • Scope and context
      • Result builder
      • Static Forms
      • Widgets in Forms
      • Dynamic Forms
      • Form layout customization
      • Related data invalidation
    • Charts
      • Value
      • Objective
      • Percentage
      • Distribution
      • Leaderboard
      • Time-based
    • Fields
      • Add fields
      • Move, rename and remove fields
      • Override binary field mode
      • Override writing behavior
      • Override filtering behavior
      • Override sorting behavior
      • Validation
    • Hooks
      • Collection hook
      • Collection override
    • Pagination
    • Plugins
      • Write your own
    • Relationships
      • To a single record
      • To multiple records
      • Computed foreign keys
      • Under the hood
    • Search
    • Segments
  • Frontend customization
    • Smart Charts
      • Create a table chart
      • Create a bar chart
      • Create a cohort chart
      • Create a density map
    • Smart Views
      • Create a Map view
      • Create a Calendar view
      • Create a Shipping view
      • Create a Gallery view
      • Create a custom tinder-like validation view
      • Create a custom moderation view
  • Deploying to production
    • Environments
      • Deploy on AWS
      • Deploy on Heroku
      • Deploy on GCP
      • Deploy on Ubuntu
    • Development workflow
    • Using branches
    • Deploying your changes
    • Forest Admin CLI commands
      • init
      • login
      • branch
      • switch
      • set-origin
      • push
      • environments:create
      • environments:reset
      • deploy
  • Under the hood
    • .forestadmin-schema.json
    • Data Model
      • Typing
      • Relationships
    • Security & Privacy
Powered by GitBook
On this page
  • Step 1: Install the new agent and remove the old one
  • Step 2: Modify the settings
  • Step 3: Agent customization

Was this helpful?

  1. Getting started
  2. Migrating legacy agents

Migration steps

This is the official documentation of the forestadmin-agent-django and forestadmin-agent-flask Python agents.

Step 1: Install the new agent and remove the old one

# install new agent
pip3 install forestadmin-agent-django
# uninstall the old one
pip3 uninstall django-forestadmin

Also you have to remove the initialization method call init_forest() (and it's import) from the project/wsgi.py file.

Step 2: Modify the settings

The way to use forest settings changes from dictionary to variables:

FOREST = {
    'FOREST_ENV_SECRET': 'env secret variable',
    'FOREST_AUTH_SECRET': 'auth secret variable'
}
FOREST_ENV_SECRET = 'env secret variable',
FOREST_AUTH_SECRET = 'auth secret variable'

In project/urls.py, change the url inclusion:

urlpatterns = [
    path('forest', include('django_forest.urls')),
    # ...
    # if you had any smart view with declared urls, you can remove them
    # path('forest', include('app.urls')),
]
urlpatterns = [
    path("", include("forestadmin.django_agent.urls")),
    # ...
]

Step 3: Agent customization

PreviousRecommendationsNextCode transformations

Last updated 7 months ago

Was this helpful?

The settings INCLUDED_MODELS and EXCLUDED_MODELS are now replaced by the options when adding a data source. See the dedicated documentation about and

The smart collection feature is removed from agent v2. Read to learn how to customize your Django agent v2, and read the next "Code transformations" section to learn how to port your previous smart collections to the new agent.

adding django data source
collection selection
this section