0

I'm running two Flask-Apps on my server simultaneously. Now I wanted to make a run.pyin their parent directory to serve all of their routes.
This is the structure:

| - run.py
| - app1/
|    |- app1.py
|    |- static
|    |- templates
| - app2/
|    |- app2.py
|    |- static
|    |- templates

Each of the Apps have their own routes.
My question is:
What do I have to write into the run.py-File so that when I browse to the_url\app1\ I get the '/'-route of my app1.py? And what do I have to write so that the_url/app1/some/url leads me to the /some/url-route of my app1 (and app2)

Thanks for your answers

Tobi Fischer
  • 36
  • 2
  • 6

1 Answers1

0

I do not know, what your exact problem is:

I'm running two Flask-Apps on my server simultaneously.

According to this, you mean: »I am running AppA on port abcd and another AppB on port efgh«. This requires two independently running python processes, each with its own run.py.


What you could do is, when the two are "releated" somehow, that you use Blueprints. Blueprints make it possible to separate functionality within one flask app: so this means, when the two share the same users etc. you could throw them together in one app.

The routes could be registered

app1 = Blueprint('app1', __name__, url_prefix='/app1')
app2 = Blueprint('app2', __name__, url_prefix='/app2')

The separation could be managed with permissions.

Thomas Junk
  • 5,588
  • 2
  • 30
  • 43