vendredi 27 juin 2014

Redirect to relative django path

Vote count:


See these examples:

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

def my_view(request):
return redirect('/some/url/')

There is no identification to tell Django if the first argument is a view or a URL. I wanted to specify 'login', a relative path, but it looks for the view. On my local host, I had it working with '/login' since I was working in the root directory, but now after I deployed my project to my web server, I put it in a folder. Is specifying '/myfolder/login' (absolute path) the only way to use the redirect shortcut?

asked 47 secs ago

Aucun commentaire:

Enregistrer un commentaire