How to make https work fine under django server?

5,860 views
Skip to first unread message

vincen...@gmail.com

unread,
Sep 4, 2015, 3:50:57 PM9/4/15
to Django users
Hi, everyone. I'm a new user of Django.
I have established an app and run a server on Django.
However, when I open a URL of my app(e.g. https://example.com/.../), it always shows the following error on the command line. 

You're accessing the development server over HTTPS, but it only supports HTTP

Worth to mention that the URLs start with https:// 
because I set CSRF_COOKIE_SECURE and SESSION_COOKIE_SECURE to be true, and also set SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https').
There may be other configurations I forget to mention.
In a word, the URLs starting with http:// are redirected by django to be https:// 

I really need URLs starting with https:// to work fine on the server. 
So what should I do?

Thomas G Lockhart

unread,
Sep 4, 2015, 4:05:09 PM9/4/15
to django...@googlegroups.com
If you want https then you need to use a production server such as Apache, not the development server built into Django.

hth

- Tom



--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/10a6bb7a-a874-41da-bc1a-46fc6af80718%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

vincen...@gmail.com

unread,
Sep 5, 2015, 7:26:23 AM9/5/15
to Django users
I find there are some configuration about using Django with Apache and mod_wsgi in Django document. So, I install apache-2.4.7 and mod_wsgi.
But the thing is that I'm confused about how it can work. Should I start a server on mod_wsgi?
Is that possible to support https?


Luis Zárate

unread,
Sep 5, 2015, 12:00:06 PM9/5/15
to django...@googlegroups.com

https://www.digitalocean.com/community/tutorials/how-to-run-django-with-mod_wsgi-and-apache-with-a-virtualenv-python-environment-on-a-debian-vps

This tutorial could help you.

El sábado, 5 de septiembre de 2015, <vincen...@gmail.com> escribió:
> I find there are some configuration about using Django with Apache and mod_wsgi in Django document. So, I install apache-2.4.7 and mod_wsgi.
> But the thing is that I'm confused about how it can work. Should I start a server on mod_wsgi? Is that possible to support https?
>
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/51d6f097-6120-4cb8-8b12-4961d83936b4%40googlegroups.com.

> For more options, visit https://groups.google.com/d/optout.
>

--
"La utopía sirve para caminar" Fernando Birri



Reply all
Reply to author
Forward
0 new messages