Forums

2 flask, 1 web app

Hi, i'm trying to deploy 2 flask app that are in the same home directory using only 1 web app with this line of code,from werkzeug.middleware.dispatcher import DispatcherMiddleware. I have the free account, it is possible or not appreciate your response.

That would work as long as there is one wsgi app on the outside.

this is the wsgi file i have at the moment. im not sure I understand this statement, "as long as there is one wsgi app on the outside". thanks for your response and appreciate your help. the 1st app work perfectly the problem is the 2nd one.

This file contains the WSGI configuration required to serve up your

web application at http://<your-username>.pythonanywhere.com/

It works by setting the variable 'application' to a WSGI handler of some

description.

The below has been auto-generated for your Flask project

import sys from werkzeug.middleware.dispatcher import DispatcherMiddleware

add your project directory to the sys.path

project_home = '/home/kawasaki500/mysite' if project_home not in sys.path: sys.path = [project_home] + sys.path

Import the first Flask app from the AlpacaApi_app module

from AlpacaApi_app import app as app1

Import the second Flask app from the OandaApi_app module

from OandaApi_app import app as app2

Set up the DispatcherMiddleware

application = DispatcherMiddleware(app1, { '/app2': app2 })

It seems to me like both apps are working. Is there any particular issue you're experiencing?