Skip to content

Simplified redirects #1370

Closed
Closed

Description

@rpkyle

Several modifications are proposed in plotly/dashR#225 to support user-defined server routes in Dash for R, which will include a convenience function for URL redirects.

Following discussion with @alexcjohnson, it seems that we could make the same UI improvements within Dash for Python as well.

For example, this server.route decorator:

@server.route('/daq')
def redirect_daq():
    return redirect('/dash-daq', code=301)

could be rewritten more concisely as

app.redirect('/daq', '/dash-daq')

Further, a parameterized redirect such as

@server.route('/daq/<path:subpath>')
def redirect_daq_part(subpath):
    return redirect('/dash-daq/{}'.format(escape(subpath)), code=301)

... might look instead like

app.redirect('/daq/<path:subpath>', lambda subpath: '/dash-daq/{}'.format(escape(subpath)))

@Marc-Andre-Rivet

Activity

  1. added this to the OSS milestone on Aug 21, 2020
  2. Marc-Andre-Rivet commented on Aug 26, 2020

    @Marc-Andre-Rivet
    Contributor

    @rpkyle Should we expose the redirect code in the simplified redirect? Optional with 301 (permanent) default?

  3. gvwilson commented on Jul 17, 2024

    @gvwilson
    Contributor

    Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are most important to our community. If this issue is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. (Please note that we will give priority to reports that include a short reproducible example.) If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions