Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

PKI Suite samples for Python

This folder contains Python sample projects demonstrating the usage of Lacuna Software's PKI Suite.

For other languages, please visit the repository root.

Default sample (Flask)

A sample using Flask to build a web application can be found on folder flask.

Steps to execute the sample:

  1. Download the project or clone the repository

  2. Install dependencies: pip install -r requirements.txt

  3. Set the FLASK_APP environment variable to define the name of the application that should be run: FLASK_APP=sample

  4. In order to accept test certificates you need to set the environment: variable FLASK_ENV="development

  5. Run the web application: flask run

  6. Access the URL http://localhost:5000

Optionally you can create and activate a "virtualenv" to avoid mixing library versions:

$ virtualenv <venv>
$ source bin/activate (on Windows: ./<venv>/Scripts/activate)
$ pip install -r requirements.txt
$ python manage.py runserver
$ deactivate

Running with devcontainer

The flask sample also has a devcontainer. To run it, just open the folder in flask and install the Devcontainer for VSCode to run it, next, use the launch.json configuration in the Run and Debug (Ctrl+Shift+D) to run the project.

Django

A sample using Django to build a web application can be found on folder django.

Steps to execute the sample:

  1. Download the project or clone the repository

  2. Install dependencies: pip install -r requirements.txt (It might be possible that you need to run this command several times in Windows platforms due to OS errors).

  3. Run the web application: python manage.py runserver

  4. (Optional): If you have any migrations pending after running the server, go to django sample folder and run python manage.py migrate. The warnings will disappear the next time you run the application.

  5. Access the URL http://localhost:8000

Optionally you can create and activate a "virtualenv" to avoid mixing library versions:

$ virtualenv <venv>
$ source bin/activate (on Windows: ./<venv>/Scripts/activate)
$ pip install -r requirements.txt
$ python manage.py runserver
$ deactivate

REST PKI's client lib

The sample projects depend on Rest PKI client lib for Python library.

The recommended way to install REST PKI's client lib for Python is through PyPi:

pip install restpki-client

Or informing on your project's requirements.txt file:

restpki-client>=1.2.1

PKI Express's helper library

The sample projects also depend on PKI Express's library for Python library.

The recommended way to install PKI Express's lib for Python is through PyPi:

pip install pkiexpress

Or informing on your project's requirements.txt file:

pkiexpress>=1.10.0

Activating PKI Express

After installing PKI Express, is necessary to activate it. On Linux, execute the following command with root permissions:

$ sudo pkie activate LacunaPkiLicense.config

On Windows, run the PKI Express Configuration Manager (file pkiemgr.exe on the installation folder ex.: C:\Program Files\Lacuna Software\PKI Express) and follow the instructions to activate PKI Express.

See also