python - Redirect to relative django path -


see these examples:

https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#examples

def my_view(request):     ...     return redirect('some-view-name', foo='bar') #view name optional arguments  def my_view(request):     ...     return redirect('/some/url/') 

there no identification tell django if first argument view or url. wanted specify 'login', relative path, looks view. on local host, had working '/login' since working in root directory, after deployed project web server, put in folder. specifying '/myfolder/login' (absolute path) way use redirect shortcut?

try:

from django.core.urlresolvers import reverse django.http import httpresponseredirect  ...  return httpresponseredirect( reverse('login', kwargs={'foo': 'bar'}) ) 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -

jquery - Keeping Kendo Datepicker in min/max range -