Flaxon FFD
Bridge FastAPI, Flask, and Django apps into a single Flaxon application via ASGI mounting.
Flaxon FFD is a Flaxon plugin that lets you run real, unmodified FastAPI, Flask, or Django apps side-by-side with your Flaxon app in the same process — useful for gradual migrations, reusing an existing service, or pulling in a framework-specific tool (like Django's admin, or FastAPI's auto-generated docs) without rewriting it.
from flaxon import Flaxon
from flaxon_ffd import FFDPlugin
from fastapi import FastAPI
fastapi_app = FastAPI()
@fastapi_app.get("/hello")
def hello():
return {"hello": "world"}
app = Flaxon("main")
await app.plugins.load_plugin(FFDPlugin(mounts={"/fastapi": fastapi_app}))
GET /fastapi/hello now hits your real FastAPI route — including FastAPI's own path converters, dependency injection, and auto-generated /fastapi/docs Swagger UI, completely unmodified.
How it works
Under the hood this uses app.mount_asgi(path, foreign_app) — for any request under that path prefix, Flaxon hands the raw ASGI call straight to the mounted app's own __call__, bypassing Flaxon's routing and middleware for that subtree entirely. The mounted app handles everything itself, exactly as if it were running on its own.
What this is: running multiple independent apps together in one process, each on its own URL prefix. What this isn't: a way to use Flask/FastAPI/Django extensions as if they were native Flaxon plugins. A Flask extension mounted this way still only works inside that mounted Flask app — it doesn't become available to your Flaxon routes.
Installation
pip install flaxon-ffd[fastapi] # for FastAPI
pip install flaxon-ffd[flask] # for Flask (includes a2wsgi)
pip install flaxon-ffd[django] # for Django
pip install flaxon-ffd[all] # all three
Mounting Flask or older Django (WSGI apps)
FastAPI and Django's get_asgi_application() are already ASGI — mount them directly. Flask (and WSGI-only Django setups) need translating first, via a2wsgi:
from flask import Flask
from a2wsgi import WSGIMiddleware
flask_app = Flask(__name__)
@flask_app.route("/hello")
def hello():
return {"hello": "world"}
app.plugins.load_plugin(FFDPlugin(mounts={
"/flask": WSGIMiddleware(flask_app),
}))
Mounting Django
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
from django.core.asgi import get_asgi_application
django_app = get_asgi_application()
app.plugins.load_plugin(FFDPlugin(mounts={
"/django": django_app,
}))
Multiple mounts at once
app.plugins.load_plugin(FFDPlugin(mounts={
"/fastapi": fastapi_app,
"/flask": WSGIMiddleware(flask_app),
"/django": django_app,
}))
Requirements
- Flaxon >= 0.1.9
- Python >= 3.11
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flaxon_ffd-0.1.0.tar.gz.
File metadata
- Download URL: flaxon_ffd-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
263f9d360b077837b8f859de306eae75784fdee4ea5928c01ce07b561cbb5e90
|
|
| MD5 |
c3ba17690f98645fb3a7c7c66882eb0f
|
|
| BLAKE2b-256 |
9c9810130f28e0e5c811410c885da608f44157f5cc352dcacb16c51a904b6c01
|
File details
Details for the file flaxon_ffd-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flaxon_ffd-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf0bf14a25002e702fbe9538a93ef4f516b1115fac931f57cb2e1c8a350dbd4a
|
|
| MD5 |
6a7790fd87406874e02ab49f041f750b
|
|
| BLAKE2b-256 |
9c4a0b98902262a46725e4fd38d3ea6233abe886ba3eb54d90698f79b62dd73b
|