Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make django site https in windows10

How to make django site https in windows10. I am using public IP not local host.

I tried putting the following code in settings.py got from Error "You're accessing the development server over HTTPS, but it only supports HTTP"

CORS_REPLACE_HTTPS_REFERER      = False
HOST_SCHEME                     = "http://"
SECURE_PROXY_SSL_HEADER         = None
SECURE_SSL_REDIRECT             = False
SESSION_COOKIE_SECURE           = False
CSRF_COOKIE_SECURE              = False
SECURE_HSTS_SECONDS             = None
SECURE_HSTS_INCLUDE_SUBDOMAINS  = False
SECURE_FRAME_DENY               = False

I get the following error

[09/Sep/2019 12:50:18] code 400, message Bad request version ('Gð\x1a\x15Ä«Öõß/\x02h|.\x9a\x11,\x93') [09/Sep/2019 12:50:18] You're accessing the development server over HTTPS, but it only supports HTTP.

I even made DEBUG = False

But no use still the same error.

Now my issue is I am lost in trying to implement SSL in django on Windows 10 OS

like image 787
Suhail Abdul Rehman Chougule Avatar asked Aug 30 '25 18:08

Suhail Abdul Rehman Chougule


2 Answers

Django development server (run by python manage.py runserver) cannot handle https.

Check this answer on suggestions.

One of simplest solutions from the answer is to use django-sslserver package.

Other solutions include running some kind of https proxy locally.

Or, run it not in development mode (no live reload) using wsgi server and configuring proper https on it.

like image 193
Oleg Russkin Avatar answered Sep 02 '25 14:09

Oleg Russkin


you can use ngrok to proxy your local development server to a public https url.

  • Run dev server by running python manage.py runserver
  • Run ngork by running ngrok http 8000. You will get a public https url that you can use to access your local server.
like image 43
dishant makwana Avatar answered Sep 02 '25 16:09

dishant makwana