I am in a way of making a module for my project that can be reused later also.
Lets say I have an django app named "demo" and I have included it in root url like url(r'demo/',include("demo.urls")),
Now inside "demo.urls" I want to redirect admin url to custom url.
/admin/auth/group/add/
should be redirected to any url that is of demo.urls
define a view function that redirects to your desired url:
from django.http import HttpResponseRedirect
def redirect_to_desired_url(request):
return HttpResponseRedirect('new_url/')
and then in your urls.py
urlpatterns = patterns('',
...
url(r'^/redirect_to_desired_url/$',redirect_to_desired_url),
...
)
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