Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Getting react router working with Django #559

@educepter

Description

@educepter

Describe the bug
The boilerplate code works for me. After integrating my backend, am able to query it through Postman and get expected responses. From frontend, I could see the div with "react-app" id replaced with my frontend, for the landing page.

However, my frontend uses "react-router-dom", and need to serve many paths/urls. If I just try to navigate to another path in my frontend, I get a 404 with the following error (with DEBUG=True in Django):

Using the URLconf defined in myproject.urls, Django tried these URL patterns, in this order:
[name='index']
admin/
jsreverse/ [name='js_reverse']
api/v0/auth/
api/v0/

Could you please help how to serve multiple paths from frontend with this boilerplate code. Thanks!

To Reproduce
Steps to reproduce the behavior:

  1. Add a react router in frontend with 'react-router-dom'

Expected behavior
Be able to serve multiple paths from the frontend.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions