Thursday, 15 July 2010

python - How to redirect a user after a notify url gets hit in Django? -



python - How to redirect a user after a notify url gets hit in Django? -

i looking direction. have django project fair amount of views. need redirect given user success url after task has been completed external application.

what i've done far set view corresponding entry in urls.py

# views.py def notifyurl(request): homecoming httpresponseredirect('/success_page/')

notifyurl nail external app i've written using simple request. seems django won't redirect browser calling (headless) application.

how should create work?

thanks in advance.

what asking not possible via 'redirect'.

you can redirect user @ point user makes request. if user has made request , received response, cannot later 'redirect' user in response other event happening later in backend.

what need way backend django app notify frontend (i.e. javascript app) event has occurred , user should forwarded, javascript, new url.

there 2 approaches:

'polling' - javascript periodically contacts end, eg setinterval timer requesting status url via ajax. easiest implement django. 'push' - backend contacts frontend directly... means using websockets, not easy django (or wsgi python web framework). see help though https://django-omnibus.readthedocs.org/en/latest/

python django redirect notifications

No comments:

Post a Comment