Problem
I've been following this tutorial on implementing Django cartridge with paypal. Everything is hosted on AWS. And everything is working fine at least with the sandbox account. Except return url, when I make a payment and click on the link to return to the shop I'm redirected to my complete page only that my host name is changed to my amazon instance internal ip address.
Discoveries
When form for request to Paypal is created return url field is initialised with value from Django's request.get_host(). Problem is that AWS use they own load balancing so address of the machine is returned. I've tried to enable USE_X_FORWARDED_HOST in settings but it still doesn't work.
Solution Found!!!
So solution was found here.Basically since VPS itself knows nothing about outside world in AWS you need to manually modify sites hostname. Either use SQL to modify field in the table or use Django shell.
After that proper hostname was added to request.