Skip to content

Server integration

Mesop allows you to integrate Mesop with other Python web servers like FastAPI or Flask by mounting the Mesop app which is a WSGI app.

This enables you to do things like:

  • Serve local files (e.g. images)
  • Provide API endpoints (which can be called by the web component, etc.)

API

The main API for doing this integration is the create_wsgi_app function.

create_wsgi_app

Creates a WSGI app that can be used to run Mesop in a WSGI server like gunicorn.

PARAMETER DESCRIPTION
debug_mode

If True, enables debug mode for the Mesop app.

TYPE: bool DEFAULT: False

FastAPI example

For a working example of using Mesop with FastAPI, please take a look at this repo: https://github.com/wwwillchen/mesop-fastapi

Note: you can apply similar steps to use any other web framework that allows you to mount a WSGI app.