user11603936
user11603936

Reputation: 79

Redirecting django URLs

I am trying to link the pages in a django application. when i have Home/about on my navigation

after i go to about page, when i click on home again the url is home/about/home

how do i change it just to about?

path('home/about/', views.about, name='Database-about'),

http://localhost:8000/home/about/about

Page not found (404) Request Method: GET Request URL: http://localhost:8000/home/about/about

Using the URLconf defined in Main_DB.urls, Django tried these URL patterns, in this order:

admin/
home/ [name='Database-home']
home/about/ [name='Database-about']
home/login/ [name='login']
home/login/MetaData/ [name='Database-form']
home/about/login/ [name='login']

Upvotes: 0

Views: 98

Answers (1)

mousetail
mousetail

Reputation: 8010

In order to redirect to an absolute page instead of relative, put a leading slash before the URL. Example:

/admin/
/home/

etc.

Upvotes: 1

Related Questions