I have DRF project and the react project is also within the Django project as an application. The name of the react application is frontend
.
INSTALLED_APPS = [
....
'frontend'
]
The structure of the frontend is as follows,
The only code in the project is in views,
def index(request):
return render(request, "build/index.html")
And the URL is,
from frontend.views import index
urlpatterns += [path("", index, name="index")]
Now what I was trying to do is, if the browser's URL response is 404, then instead of showing django's 404 page I would like to go the home/index of the frontend
react app. I tried to add handler404 = 'frontend.views.index'
in urls.py
, but it shows 500 internal error instead of 404 or the index of react app.
Any help would be really appreciated. Thanks in Advance.