I am working on a Django project and got stuck on url patterns and routes.
On index.html
, the pathname is ""
and the JS functions are working great. The fetch url tweets/${tweetid}
is matching with Django API route url pattern tweets/<int:tweetid>
and is working fine.
However, on profile.html
, the pathname is "profile/<int:userid>"
and JS is not working here. The fetch url tweets/${tweetid}
results the final path profile/tweets/<int:tweetid>
. Since that is not in urls.py
, I am getting an error.
How can I execute my fetch and JS functions on any html page in this web application?