3

I would like to know how I can modify the URL to the welcome page. Currently it is /superset/welcome.

It is run into superset/views/core.py in a @expose('/welcome').

I know I can modify the code inside this @expose, but I want to redirect to another url.

So I want to find the line where there is:

welcome_page = /superset/welcome

TylerH
  • 20,799
  • 66
  • 75
  • 101
Arthur Millet
  • 91
  • 2
  • 4

2 Answers2

2

In superset's file structure, navigate to:

superset/app.py

There you will find

class SupersetIndexView(IndexView):
    @expose("/")
    def index(self) -> FlaskResponse:
        return redirect("/superset/welcome")

Modify this to path where you want to redirect.

TylerH
  • 20,799
  • 66
  • 75
  • 101
gaurav1999
  • 93
  • 11
2

As of Superset 1.3, you can change the default landing page by adding this code to your Superset config:

from flask import Flask, redirect

from flask_appbuilder import expose, IndexView

from superset.typing import FlaskResponse

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

FAB_INDEX_VIEW = f"{SupersetDashboardIndexView.__module__}.{SupersetDashboardIndexView.__name__}"

In the above example, I am using /dashboard/list/ instead of the default /superset/welcome/.

The code above is Unlicensed and thus is free and unencumbered software released into the public domain.

Jonathan Hult
  • 1,351
  • 2
  • 13
  • 19
  • 1
    Cool, thanks! Improved code to select landing page based on user role name: https://gist.github.com/d9k/a638071ce7146ef01c27779a51d96f2b – d9k Jan 13 '22 at 07:45
  • I am getting an error while using this lines - `NameError: name 'BaseView' is not defined 2022-06-26 10:52:36,770:ERROR:superset.app:Failed to create app` – user1900863 Jun 26 '22 at 10:56