Mehmet Baykal

all felsefe kitap python seyahat programming alinti

Python redirect to sub website

#wsgi.py
#from app import app as application

import imp
import os
import sys


sys.path.insert(0, os.path.dirname(__file__))

wsgi = imp.load_source('wsgi', 'app.py')
application = wsgi.application

#app.py
from flask import Flask
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from werkzeug.exceptions import NotFound

from app1.app import app as app1
from app2.app import app as app2
from app3.app import app as app3


app = Flask(__name__)

app.wsgi_app = DispatcherMiddleware(NotFound(), {
    "/app1": app1,
    "/app2": app2,
    "/app3": app3
})

if __name__ == "__main__":
    app.run()