want to convert Django REST APIs from http to https in production

19 views
Skip to first unread message

JAGADESH M

unread,
Dec 15, 2018, 5:59:23 AM12/15/18
to Django users
Hi,
       I am new to django when i run Django REST API by default it is showing http://127.0.0.1 that's fine. But when i go deployment when i run APIs, even there it's running in insecure(http)
only like http://myproductionip . so can anyone help me to resolve this problem. thank you

swathi2801 Yadhav

unread,
Dec 15, 2018, 6:08:36 AM12/15/18
to django...@googlegroups.com
please keep the screenshots
the link is not working


--
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...@googlegroups.com.
To post to this group, send email to django...@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/1726cbee-ccad-49b1-bba6-3c5ef7e702b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kasper Laudrup

unread,
Dec 15, 2018, 7:23:15 AM12/15/18
to django...@googlegroups.com
Hi Jagadesh,

On 15/12/2018 11.59, JAGADESH M wrote:
> Hi,
>        I am new to django when i run Django REST API by default it is
> showing *http://127.0.0.1* that's fine. But when i go deployment when i
> run APIs, even there it's running in insecure(http)
> only like *http://myproductionip *. so can anyone help me to resolve
> this problem. thank you
>

You haven't provided any information on how you are deploying your
application in production, but I assume (or hope) you are running some
kind of web server (eg. nginx or Apache) which is communicating with
your Django app through uwsgi.

You'll need to set up your web server to serve through HTTPS. How that
is done depends on the kind of web server you are running, but there
should be tons of tutorials for that.

You'll also need a certificate. You can get one for free from
letsencrypt.org, but if you're working for someone, you should probably
ask someone where and how to deal with that instead.

It would also be a good idea to redirect insecure (HTTP through port 80)
requests to secure (HTTPS through port 443) requests. There should be
tons of tutorials for that as well for whatever web server you are using.

Hope that helps.

Kind regards,

Kasper Laudrup
Reply all
Reply to author
Forward
0 new messages