How to Run Multiple Flask Applications from the Same Server

Peter Haas
3 min readFeb 20, 2021

Route to multiple WSGI applications at different URL paths

Photo by Alberto Triano on Unsplash

Do you have multiple flask applications that you would like to run from the same domain? Do you want to be able to access them by using a URL prefix instead of by accessing a different port? Application dispatching is the solution.

Why I Wanted to Run Multiple Flask Applications

As a part of my data analyst learning journey I decided to set up a portfolio site. I decided to learn the Flask framework to deploy and showcase projects.

Since I was developing the applications at separate times in separate environments, I wanted to be able to keep them separate in deployment instead of cobbling them into the same large application. Several of the potential solutions I found just ended up placing the different applications on different ports. I wanted a solution that allowed for a modular website that could be accessed through paths on the same domain.

Enter application dispatching. With this you can combine multiple Flask applications at the WSGI level. This also allows you to combine any WSGI application. So if you have separate Flask, Django, or Dash applications you can run them in the same interpreter side by side if you want.

--

--

Peter Haas
Peter Haas

Written by Peter Haas

Python Data Analyst. Writing about Python programming, data analysis, data visualization, and whatever I’m interested in at the moment.

No responses yet