|
|
@ -4,11 +4,11 @@ Application Dispatching |
|
|
|
======================= |
|
|
|
======================= |
|
|
|
|
|
|
|
|
|
|
|
Application dispatching is the process of combining multiple Flask |
|
|
|
Application dispatching is the process of combining multiple Flask |
|
|
|
applications on the WSGI level. You can not only combine Flask |
|
|
|
applications on the WSGI level. You can combine not only Flask |
|
|
|
applications into something larger but any WSGI application. This would |
|
|
|
applications but any WSGI application. This would allow you to run a |
|
|
|
even allow you to run a Django and a Flask application in the same |
|
|
|
Django and a Flask application in the same interpreter side by side if |
|
|
|
interpreter side by side if you want. The usefulness of this depends on |
|
|
|
you want. The usefulness of this depends on how the applications work |
|
|
|
how the applications work internally. |
|
|
|
internally. |
|
|
|
|
|
|
|
|
|
|
|
The fundamental difference from the :ref:`module approach |
|
|
|
The fundamental difference from the :ref:`module approach |
|
|
|
<larger-applications>` is that in this case you are running the same or |
|
|
|
<larger-applications>` is that in this case you are running the same or |
|
|
@ -31,7 +31,7 @@ Note that :func:`run_simple <werkzeug.serving.run_simple>` is not intended for |
|
|
|
use in production. Use a :ref:`full-blown WSGI server <deployment>`. |
|
|
|
use in production. Use a :ref:`full-blown WSGI server <deployment>`. |
|
|
|
|
|
|
|
|
|
|
|
In order to use the interactive debugger, debugging must be enabled both on |
|
|
|
In order to use the interactive debugger, debugging must be enabled both on |
|
|
|
the application and the simple server, here is the "hello world" example with |
|
|
|
the application and the simple server. Here is the "hello world" example with |
|
|
|
debugging and :func:`run_simple <werkzeug.serving.run_simple>`:: |
|
|
|
debugging and :func:`run_simple <werkzeug.serving.run_simple>`:: |
|
|
|
|
|
|
|
|
|
|
|
from flask import Flask |
|
|
|
from flask import Flask |
|
|
@ -56,7 +56,7 @@ If you have entirely separated applications and you want them to work next |
|
|
|
to each other in the same Python interpreter process you can take |
|
|
|
to each other in the same Python interpreter process you can take |
|
|
|
advantage of the :class:`werkzeug.wsgi.DispatcherMiddleware`. The idea |
|
|
|
advantage of the :class:`werkzeug.wsgi.DispatcherMiddleware`. The idea |
|
|
|
here is that each Flask application is a valid WSGI application and they |
|
|
|
here is that each Flask application is a valid WSGI application and they |
|
|
|
are combined by the dispatcher middleware into a larger one that |
|
|
|
are combined by the dispatcher middleware into a larger one that is |
|
|
|
dispatched based on prefix. |
|
|
|
dispatched based on prefix. |
|
|
|
|
|
|
|
|
|
|
|
For example you could have your main application run on ``/`` and your |
|
|
|
For example you could have your main application run on ``/`` and your |
|
|
|