---
title: "Python Flash samples project"
description: "Python Flask samples project showing Rest PKI used with Web PKI on a Flask app, with the pip install and flask run steps and a project map."
canonical: "https://docs.lacunasoftware.com/en-us/articles/rest-pki/python/flask"
locale: "en"
product: "Rest PKI (legacy)"
last_updated: "2026-07-14"
---

# Python Flash samples project

The **Python Flask samples project** shows how to use [Rest PKI](https://docs.lacunasoftware.com/en-us/articles/rest-pki) together with [Web PKI](https://docs.lacunasoftware.com/en-us/articles/web-pki)
on a Python project using the [Flask](http://flask.pocoo.org/) framework. It is hosted on GitHub at:

https://github.com/LacunaSoftware/PkiSuiteSamples/tree/master/python/flask

## Running the project

1. [Download the project](https://github.com/LacunaSoftware/PkiSuiteSamples/archive/master.zip)
   or clone the repository
1. Install dependencies: `pip install -r requirements.txt`
1. Set the `FLASK_APP` environment variable to define the name of app that
 should be run: `FLASK_APP=sample`
1. Run the web application: `flask run`
1. Access the URL [http://localhost:5000](http://localhost:5000)

## Project map

This section lists where to find the relevant parts in each feature sample on the project.

### Authentication with digital certificate

* View: [authentication_rest.py](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/views/authentication_rest.py)
* Templates:
  * [index.html](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/templates/authentication_rest/index.html) (JavaScript on [signature-form.js](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/static/js/signature-form.js))
  * [complete.html](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/templates/authentication_rest/complete.html)

### PAdES signature with file already on server

* View: [pades_signature_rest.py](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/views/pades_signature_rest.py)
* Templates:
  * [index.html](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/templates/pades_signature_rest/index.html) (JavaScript on [signature-form.js](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/static/js/signature-form.js))
  * [complete.html](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/templates/pades_signature_rest/complete.html)

### PAdES signature with file uploaded by user

After the file upload (which is crudely implemented merely for demonstration purposes on the view [server_files.py](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/views/server_files.py) and template [index.html](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/templates/server_files/index.html))
is done the control flow is the same as in the sample [PAdES signature with the file already on server](https://docs.lacunasoftware.com/en-us/articles/rest-pki/python/flask#pades), but with the URL parameter `userfile` filled.

### PAdES co-signature

After the control flow of the sample [PAdES signature with file already on server](https://docs.lacunasoftware.com/en-us/articles/rest-pki/python/flask#pades) is completed an the link *Co-sign with another certificate* is clicked, the same control flow is repeated, but now with the URL parameter `userfile` filled.

### PAdES marks

Not yet available on this project.

### PAdES signature using server key

Not yet available on this project.

### PAdES signature without client communication

Not yet available on this project.

### Open/validate an existing PAdES signature

Not yet available on this project.

### Printer-friendly version

Not yet available on this project.

### CAdES signature with file already on server

* View: [cades_signature_rest.py](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/views/cades_signature_rest.py)
* Templates:
  * [index.html](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/templates/cades_signature_rest/index.html) (JavaScript on [signature-form.js](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/static/js/signature-form.js))
  * [complete.html](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/templates/cades_signature_rest/complete.html)

### CAdES signature with file uploaded by user

After the file upload (which is crudely implemented merely for demonstration purposes on the view [server_files.py](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/views/server_files.py) and template [index.html](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/templates/server_files/index.html)) is done the control flow is the same as in the sample [CAdES signature with file already on server](https://docs.lacunasoftware.com/en-us/articles/rest-pki/python/flask#cades), but with the URL parameter `userfile` filled.

### CAdES co-signature

After the control flow of the sample [CAdES signature with file already on server](https://docs.lacunasoftware.com/en-us/articles/rest-pki/python/flask#cades) is completed and the link *Co-sign with another certificate* is clicked, the same control flow is repeated, but now with the URL parameter `cmsfile` filled.

### CAdES signature using server key

Not yet available on this project.

### Open/validate an existing CAdES signature

Not yet available on this project.

### XML signature of the entire document

* View: [xml_signature_rest.py](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/views/xml_signature_rest.py)
* Templates:
  * [index.html](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/templates/xml_signature_rest/index.html)
  (JavaScript on [signature-form.js](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/static/js/signature-form.js))
  * [complete.html](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/templates/xml_signature_rest/complete.html)

### XML signature of an element

* View: [xml_signature_rest.py](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/views/xml_signature_rest.py)
* Templates:
  * [index.html](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/templates/xml_nfe_signature_rest/index.html) (JavaScript on [signature-form.js](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/static/js/signature-form.js))
  * [complete.html](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/templates/xml_nfe_signature_rest/complete.html)

### XAdES signature of an element

Not yet available on this project.

### Open/validate signatures on an existing XML file

Not yet available on this project.

### Batch of PAdES signatures

* View: [batch_pades_signature_rest.py](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/views/batch_pades_signature_rest.py)
* Template: [index.html](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/templates/batch_pades_signature_rest/index.html) (JavaScript on [batch-signature-rest-form.js](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/static/js/batch-signature-rest-form.js)) 

### Optimized batch of PAdES signatures

Not yet available on this project.

### Batch of CAdES signatures

* View: [batch_cades_signature_rest.py](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/views/batch_cades_signature_rest.py)
* Template: [index.html](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/templates/batch_cades_signature_rest/index.html) (JavaScript on [batch-signature-rest-form.js](https://github.com/LacunaSoftware/PkiSuiteSamples/blob/master/python/flask/sample/static/js/batch-signature-rest-form.js))

### Batch of XML signatures of elements on the same document

Not yet available on this project.
