how to run django in pycharm in https
You can use runserver_plus
extension. It depends on Werkzeug
, so you have to install it first. Installation:
pip install Werkzeug
pip install django-extensions
pip install pyOpenSSL
Then add django_extensions
to your INSTALLED_APPS
inside settings.py
:
INSTALLED_APPS = (
...
'django_extensions',
)
Now you need to generate self-signed certificate for your local server. Something like this, credits to Diego Woitasen:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365
And now you can run Django this way:
python manage.py runserver_plus --cert-file /path/to/cert.crt
And some links for sources:
-
runserver_plus
with SSL. -
Werkzeug
installation.