-1

I cloned the superset code in local and there was already a FLASK server file named app.py , app.py

def create_app() -> Flask:
    app = SupersetApp(__name__)

    try:
        # Allow user to override our config completely
        config_module = os.environ.get("SUPERSET_CONFIG", "superset.config")
        app.config.from_object(config_module)

        app_initializer = app.config.get("APP_INITIALIZER", SupersetAppInitializer)(app)
        app_initializer.init_app()
        print('Hello world')
        return app

    # Make sure that bootstrap errors ALWAYS get logged
    except Exception as ex:
        logger.exception("Failed to create app")
        raise ex

and I tried adding another function inside the same file but not gets called from the react end,

new function

api = Flask(__name__)
@api.route('/api/profile')
def my_profile(): 
    response_body = {
        "name": "Nagato",
        "about" :"Hello! I'm a full stack developer that loves python and javascript"
    }

    return response_body

But it shows http://localhost:8088/api/profile 404 not found error.

Note : I am new to react.js .So, forgive me if my question is very dumb..

Ananthan
  • 37
  • 1
  • 6

1 Answers1

0

Replace @api.route('/profile') with @api.route('/api/profile').
Or change your react http request url to /profile not /api/profile.

Gui
  • 21
  • 5
  • I have edited the question with clearer code. My doubt is , whether this error happening because of any wrong initialization of flask name? – Ananthan Sep 19 '22 at 03:22