Using Django along with Flask

If I were you I would take the Django templates from the designer and convert them to Jinja2, then build the application 100% in Flask. But since you asked...

is this doable? or does this sound a crazy idea?

Yes to both :)

Can you kindly give some guidance?

Here is a simple way:

You write the two applications, one in Flask and one in Django. Let's assume you solve all the problems you will have when trying to share database or other resources and now you have the two applications running, each with its own web server and each listening for requests on a different port.

You now put a proxy web server as your front web server to the outside world and proxy the requests that come from clients to one or the other application depending on the URL. You can make all the URLs for the Flask application have the format http://hostname/api/..., and then key off of the api in the URL to separate the requests in the proxy server and give them to the proper application.

Because from the outside all requests go to the same hostname and port (that of the proxy server) you will not have any trouble with cross-site scripting.


I am a little late to the party but Application Dispatching should help with this. According to the intro in the documentation this is how it goes:

Application dispatching is the process of combining multiple Flask applications on the WSGI level. You can not only combine Flask applications into something larger but any WSGI application. This would even allow you to run a Django and a Flask application in the same interpreter side by side if you want.


You can use Django to create HTML using Django Template and serve them via Flask. It is doable.