# Migration steps

{% hint style="success" %}
This is the official documentation of the `forestadmin-agent-django` and `forestadmin-agent-flask` Python agents.
{% endhint %}

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

```bash
# 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:

{% tabs %}
{% tab title="Old agent" %}

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

{% endtab %}

{% tab title="New agent" %}

```python
FOREST_ENV_SECRET = 'env secret variable',
FOREST_AUTH_SECRET = 'auth secret variable'
```

{% endtab %}
{% endtabs %}

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

{% tabs %}
{% tab title="Old agent" %}

```python
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')),
]
```

{% endtab %}

{% tab title="New agent" %}

```python
urlpatterns = [
    path("", include("forestadmin.django_agent.urls")),
    # ...
]
```

{% endtab %}
{% endtabs %}

The settings `INCLUDED_MODELS` and `EXCLUDED_MODELS` are now replaced by the options when adding a data source. See the dedicated documentation about [adding django data source](https://docs.forestadmin.com/developer-guide-agents-python/data-sources/provided-data-sources/django) and [collection selection](https://docs.forestadmin.com/developer-guide-agents-python/data-sources/getting-started/partial-imports)

### Step 3: Agent customization

The smart collection feature is removed from agent v2. Read [this section](https://docs.forestadmin.com/developer-guide-agents-python/agent-customization/agent-customization) 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.
