# 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](/developer-guide-agents-python/data-sources/provided-data-sources/django.md) and [collection selection](/developer-guide-agents-python/data-sources/getting-started/partial-imports.md)

### Step 3: Agent customization

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.forestadmin.com/developer-guide-agents-python/getting-started/migrating/steps.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
