This folder contains Python sample projects demonstrating the usage of Lacuna Software's PKI Suite.
For other languages, please visit the repository root.
A sample using Flask to build a web application can be found on folder flask.
Steps to execute the sample:
-
Download the project or clone the repository
-
Install dependencies:
pip install -r requirements.txt -
Set the
FLASK_APPenvironment variable to define the name of the application that should be run:FLASK_APP=sample -
In order to accept test certificates you need to set the environment: variable
FLASK_ENV="development -
Run the web application:
flask run -
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
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.
A sample using Django to build a web application can be found on folder django.
Steps to execute the sample:
-
Download the project or clone the repository
-
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). -
Run the web application:
python manage.py runserver -
(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. -
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
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
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
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.