On Tue, Feb 23, 2016 at 6:03 AM, Bernardo Garcia <botib...@gmail.com> wrote:
> Hi everyone Djangonauts > :) > > Currently I am exposing a Django application (for the momento is just > thier users schema) with Django Rest Framework and happen that each > serialized model, in the url attribute, I have is the localhost machine > address development and don't take the hostname of my production server > machine which is located in amazon like as EC2 instance > > > In this picture can detailed it. > Nginx is proxying the end-users' request to http://127.0.0.1:8000, which is where Gunicorn is running. Gunicorn has no idea that there is a proxy in front of it, so it assumes that the request is being sent by the server itself, to the server itself. Gunicorn then passes along the Host header to Django/DRF, which in turn uses it to generate the URL's that you are getting. You need to tell Nginx to send the correct headers to indicate to Gunicorn that the connection is being proxied, and the correct address to use. See this SO: http://stackoverflow.com/questions/19669376/django-rest-framework-absolute-urls-with-nginx-always-return-127-0-0-1 -James -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUuy1nKmLqgT%2BJFPsRDDkcxkaxA%3DU46jZfHcD5Xnawg2w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.