GitHub user dosubot[bot] added a comment to the discussion: Attribute not found 
error in superset_config.py

<!-- Answer -->
No, that method won't work in Superset 5.x. The FAB_INDEX_VIEW config is 
completely ignored in version 5 and later—Superset always uses its built-in 
SupersetIndexView and never loads your custom class via FAB_INDEX_VIEW, which 
is why you see the AttributeError even if your class is defined correctly. This 
is a breaking change from previous versions and there are no workarounds or 
edge cases where FAB_INDEX_VIEW still works in 5.x 
([source](https://github.com/apache/superset/issues/34441), 
[source](https://github.com/apache/superset/issues/34422)).

To customize the IndexView in Superset 5, you must use FLASK_APP_MUTATOR. 
Define your custom IndexView class, then set appbuilder.indexview to it inside 
a function and assign that function to FLASK_APP_MUTATOR in your config. 
Example:

```python
from flask_appbuilder import expose, IndexView
from superset.typing import FlaskResponse

class SupersetDashboardIndexView(IndexView):
    @expose("/")
    def index(self) -> FlaskResponse:
        return redirect("/dashboard/list/")

def mutate_app(app):
    from superset.extensions import appbuilder
    appbuilder.indexview = SupersetDashboardIndexView

FLASK_APP_MUTATOR = mutate_app
```

Remove any FAB_INDEX_VIEW lines from your config. If you’re running in Docker 
Compose, make sure your config is at 
`/app/docker/pythonpath_dev/superset_config_docker.py` and restart your 
containers so it’s picked up 
([details](https://github.com/apache/superset/issues/34441)). If you still see 
errors, check your logs for import or syntax errors in your config file—any 
such error will prevent your class from being available.


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/6fe4c3ac-3397-42e2-b4db-63ff2a474f23?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/6fe4c3ac-3397-42e2-b4db-63ff2a474f23?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/6fe4c3ac-3397-42e2-b4db-63ff2a474f23?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/6fe4c3ac-3397-42e2-b4db-63ff2a474f23?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/6fe4c3ac-3397-42e2-b4db-63ff2a474f23?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/6fe4c3ac-3397-42e2-b4db-63ff2a474f23?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/6fe4c3ac-3397-42e2-b4db-63ff2a474f23?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat
 with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&
 nbsp;[![Join 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/34530)

GitHub link: 
https://github.com/apache/superset/discussions/34530#discussioncomment-13989120

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to