I am using django built-in login system for my website. Whenever I create an account and try to login, it redirects to the page http://127.0.0.1:8000/accounts/profile/
and gives error page not found.
But when I manually remove the accounts/profile/
part from url, it logins into the website. How can I make my django system to directly redirect to http://127.0.0.1:8000
rather than the above mentioned URL.
Here is my urls.py file code:
urlpatterns = [
path('',include('feedback.urls')),
path('accounts/', include('django.contrib.auth.urls')),
path('admin/', admin.site.urls),
path('login/', auth_views.login, {'template_name': 'login.html'}, name='login'),
path('logout/', auth_views.logout, {'next_page': 'login'}, name='logout'),
path('signup/', core_views.signup, name='signup'),
]
feedback/urls.py:
urlpatterns = [
path('create_url/',views.create_url,name='create_url'),
path('submit_affective/',views.submit_affective,name='submit_affective'),
path('submit_cognitive/',views.submit_cognitive,name='submit_cognitive'),
path('thanks/',views.thanks,name='thanks'),
path('detail_affective/<int:id>',views.detail_affective,name='detail_affective'),
path('detail_cognitive/<int:id>',views.detail_cognitive,name='detail_cognitive'),
path('',views.index,name='index'),
]
The solution you are looking for is in settings.py.
By default after login django redirects the user to an accounts/profile page. If you want to redirect to a different place you need to edit the LOGIN_REDIRECT_URL. Doing that you can send the user to a different page
Here is the documentation for that setting
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With