Y
Y
Yzurgzd2020-10-09 11:56:51
React
Yzurgzd, 2020-10-09 11:56:51

How to display one template for all urls?

Using DRF + React js
views.py

def index(request):
    return render(request, 'index.html')


urls.py
urlpatterns = [
    path('', views.index)
]


Router React
<Router>
        <>
          <div className="site">
            <div className="site-content">
              <Header />
              <Switch>
                <Route exact path="/" component={Home} />
                <Route exact path="/apps/" component={List} />
                <Route exact path="/app/:slug" component={Detail} />
              </Switch>
            </div>
            <Footer />
          </div>
        </>
</Router>


When updating all pages except the main page, Django does not return the index.html template.
How to always return index.html template?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Makarov, 2020-10-09
@kirbi1996

next js

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question