1

I need to run a python Django project with Pycharm IDE locally in HTTPS so that other services can talk with my service without any errors.

I don't manage to run it locally in HTTPS

Nadav
  • 2,389
  • 9
  • 41
  • 58

1 Answers1

1

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:

Yevgeniy Kosmak
  • 3,038
  • 2
  • 6
  • 24