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.
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.
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.
>>> from django.contrib.sites.models import Site
>>> website = Site.objects.all()[0] #or choose the website you need
>>> one.domain = 'myveryspecialdomain.com'
>>> one.save()
After that proper hostname was added to request.