Skip to content

Prepare your application for deployment

Development and production do not imply the same security, reliability and performance level. These requirements imply specific tools that will impact the code structure.

A basic application as an example

Create a file, put the following content inside, then install Taipy with pip install taipy:

import taipy as tp

gui = Gui(page="# Getting started with *Taipy*"), title="Taipy Demo")

You can run this application with python and access it from your browser.

If you look at the console, you will see the following output:

* Server starting on
* Serving Flask app ‘Taipy’ (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Server starting on

Flask generates this warning because it is a development and not a production server.


Following the recommendation of Flask we will use Gunicorn for production. Gunicorn will run your application differently than Python does. You should update the application to:

import taipy as tp

gui = tp.Gui(page="# Getting started with *Taipy*")

# Here we are defining the `app` variable.
# _Gunicorn_ will use this variable to serve your application.
app =, title="Taipy Demo", run_server=False)

The application is now ready to be served by Gunicorn.


Click here to obtain more information on the run_server parameters.

Running the application with Gunicorn

First, install Gunicorn and Gevent. Gevent will be used by Gunicorn as a worker:

pip install gunicorn gevent


If you want more information about running Gunicorn with Gevent, have a look at the official documentation.

Now start Gunicorn by running:

gunicorn -k gevent -w 1 --bind= --timeout 1800 main:app

Your application is now responding, and you can access it from your browser.

Using the same code in development and production

Debugging with Gunicorn is not as easy as debugging with the python command. To be able to switch from debugging to ready to production, you should follow this structure:

import taipy as tp

gui = tp.Gui(page="# Getting started with *Taipy*")

if __name__ == '__main__':
    # Execute by the _Python_ interpretor, for debug only., title="Taipy Demo")
    # Execute by _Gunicorn_, for production environment.
    app =, title="Taipy Demo", run_server=False)

You can now run your application with both commands.

For production:

gunicorn -k gevent -w 1 --bind= --timeout 1800 main:app

For development: