Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save NavpreetSamra/c92a56b4899d8f89a96c912d3a58a823 to your computer and use it in GitHub Desktop.

Select an option

Save NavpreetSamra/c92a56b4899d8f89a96c912d3a58a823 to your computer and use it in GitHub Desktop.

Revisions

  1. NavpreetSamra revised this gist Apr 1, 2019. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion django-runserver-ssl.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@
    https://stackoverflow.com/questions/8023126/how-can-i-test-https-connections-with-django-as-easily-as-i-can-non-https-connec
    ## Instalation ##

    ```bash
  2. NavpreetSamra revised this gist Apr 1, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions django-runserver-ssl.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    https://stackoverflow.com/questions/8023126/how-can-i-test-https-connections-with-django-as-easily-as-i-can-non-https-connec
    ## Instalation ##

    ```bash
  3. Claudio Sanches renamed this gist Oct 16, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. Claudio Sanches created this gist Oct 16, 2013.
    61 changes: 61 additions & 0 deletions tutorial.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,61 @@
    ## Instalation ##

    ```bash
    [sudo] apt-get install stunnel
    ```

    ## Configuration ##

    ```bash
    cd path/to/django/project
    mkdir stunnel
    cd stunnel
    ```

    Create the key:

    ```bash
    openssl genrsa 1024 > stunnel.key
    openssl req -new -x509 -nodes -sha1 -days 365 -key stunnel.key > stunnel.cert
    cat stunnel.key stunnel.cert > stunnel.pem
    ```

    Create the `dev_https` file with:

    ```bash
    pid=

    cert = stunnel/stunnel.pem
    sslVersion = SSLv3
    foreground = yes
    output = stunnel.log

    [https]
    accept=8443
    connect=8001
    TIMEOUTclose=1
    ```

    Now go to project root and create a `runserver` file:

    ```bash
    stunnel4 stunnel/dev_https &
    python manage.py runserver&
    ```

    Sets the permission:

    ```bash
    chmod a+x runserver
    ```

    The SSL works in:


    ```
    https://localhost:8443
    ```

    ##### REF #####

    http://stackoverflow.com/questions/8023126/how-can-i-test-https-connections-with-django-as-easily-as-i-can-non-https-connec